Guest User

Untitled

a guest
Jun 8th, 2024
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.25 KB | Source Code | 0 0
  1. // C++ code
  2. //
  3. #include <Servo.h>
  4.  
  5. Servo servo_1;
  6. Servo servo_2;
  7. Servo servo_3;
  8. Servo servo_4;
  9. Servo servo_5;
  10.  
  11. int WiggleCnt = 3;
  12. int LoopCnt;
  13.  
  14. void setup() {
  15.   servo_1.attach(1, 500, 2500);
  16.   servo_2.attach(2, 500, 2500);
  17.   servo_3.attach(3, 500, 2500);
  18.   servo_4.attach(4, 500, 2500);
  19.   servo_5.attach(5, 500, 2500);
  20.  
  21.   for (LoopCnt = 0; LoopCnt < WiggleCnt; ++LoopCnt) {
  22.     delay(1000);
  23.     servo_1.write(150);
  24.     delay(1000);
  25.     servo_1.write(0);
  26.   }
  27.   servo_1.write(150);
  28.  
  29.   delay(2000);
  30.  for (LoopCnt = 0; LoopCnt < WiggleCnt; ++LoopCnt) {
  31.     delay(1000);
  32.     servo_2.write(150);
  33.     delay(1000);
  34.     servo_2.write(30);
  35.   }
  36.   servo_2.write(150);
  37.  
  38.   delay(2000);
  39.    for (LoopCnt = 0; LoopCnt < WiggleCnt; ++LoopCnt) {
  40.     delay(1000);
  41.     servo_3.write(180);
  42.     delay(1000);
  43.     servo_3.write(30);
  44.   }
  45.   servo_3.write(180);
  46.  
  47.    
  48.  delay(2000);
  49.  for (LoopCnt = 0; LoopCnt < WiggleCnt; ++LoopCnt) {
  50.     delay(1000);
  51.     servo_4.write(180);
  52.     delay(1000);
  53.     servo_4.write(30);
  54.   }
  55.   servo_4.write(180);
  56.  
  57.   delay(2000);
  58.    for (LoopCnt = 0; LoopCnt < WiggleCnt; ++LoopCnt) {
  59.     delay(1000);
  60.     servo_5.write(180);
  61.     delay(1000);
  62.     servo_5.write(30);
  63.   }
  64.   servo_5.write(180);  
  65. }
  66.  
  67. void loop() {
  68. }
Tags: #arduino
Advertisement
Add Comment
Please, Sign In to add comment