Skip to content

Commit 91158fb

Browse files
committed
Add a new example
Add a new example
1 parent a8eaecb commit 91158fb

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* ServoMotorDondurme2 örneği,
3+
* D9 pinine bağlanan servo motor 0-3000 ms aralığında 250 ms'lik adımlarla önce saat yönüne sonra saat yönünün tersine dönmektedir.
4+
* 0 ms 0 derecedir.
5+
* 1500 ms 90 derecedir.
6+
* 3000 ms 180 derecedir.
7+
*/
8+
#include <Deneyap_Servo.h> // Deneyap Servo kütüphanesi eklenmesi
9+
10+
Servo myservo; // Servo sınıfında nesne tanımlanması
11+
12+
void setup() {
13+
myservo.attach(D9); // Servo motorun D9 pinine bağlanması /*attach(pin, channel=0, freq=50, resolution=12) olarak belirlenmiştir. Kullandığınız motora göre değiştirebilirsiniz */
14+
}
15+
16+
void loop() {
17+
for (int pos = 0; pos <= 3000; pos += 250) { // 0'dan 3000'e 250 aralıklarla artarak
18+
myservo.writeMicroseconds(pos); // servo motorun saat yönünde 250 ms aralıklarla dönmesi
19+
delay(1000);
20+
}
21+
for (int pos = 3000; pos >= 0; pos -= 250) { // 3000'dan 0'a 250 aralıklarla azalarak
22+
myservo.writeMicroseconds(pos); // servo motorun saat yönünün tersine 250 ms aralıklarla dönmesi
23+
delay(1000);
24+
}
25+
}

0 commit comments

Comments
 (0)