Advertisement
JosipZ

servo

Oct 3rd, 2024
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | Software | 0 0
  1. #include <Servo.h>
  2.  
  3. Servo myServo;  // Kreiramo objekt tipa Servo
  4.  
  5. void setup() {
  6.   myServo.attach(9);  // Povezujemo servo na digitalni pin 9
  7. }
  8.  
  9. void loop() {
  10.   myServo.write(0);    // Okrećemo servo na 0 stupnjeva
  11.   delay(1000);         // Čekamo 1 sekundu
  12.   myServo.write(90);   // Okrećemo servo na 90 stupnjeva
  13.   delay(1000);         // Čekamo 1 sekundu
  14.   myServo.write(180);  // Okrećemo servo na 180 stupnjeva
  15.   delay(1000);         // Čekamo 1 sekundu
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement