Movimento » goLeft.ino
| 1 | 
      /* 
     | 
  
|---|---|
| 2 | 
          Progetto : Insetto Robot - HackLab Terni
     | 
  
| 3 | 
          Andatura in avanti verso sinistra
     | 
  
| 4 | 
          Luglio 2012
     | 
  
| 5 | 
          Autore : Cristina Begliomini
     | 
  
| 6 | 
      */
     | 
  
| 7 | 
      #include <Servo.h> 
     | 
  
| 8 | 
       | 
  
| 9 | 
      Servo frontServo;  | 
  
| 10 | 
      Servo rearServo;  | 
  
| 11 | 
      int centerTurnPos = 96;  | 
  
| 12 | 
      int frontTurnRightUp = 81;  | 
  
| 13 | 
      int frontTurnLeftUp = 99;  | 
  
| 14 | 
      int backTurnRightForward = 81;  | 
  
| 15 | 
      int backTurnLeftForward = 111;  | 
  
| 16 | 
       | 
  
| 17 | 
      void moveTurnLeft()  | 
  
| 18 | 
      {
     | 
  
| 19 | 
      frontServo.write(frontTurnRightUp);  | 
  
| 20 | 
      rearServo.write(centerTurnPos);  | 
  
| 21 | 
      delay(65);  | 
  
| 22 | 
      rearServo.write(backTurnLeftForward);  | 
  
| 23 | 
      delay(125);  | 
  
| 24 | 
      frontServo.write(centerTurnPos);  | 
  
| 25 | 
      delay(65);  | 
  
| 26 | 
      frontServo.write(frontTurnLeftUp);  | 
  
| 27 | 
      rearServo.write(centerTurnPos);  | 
  
| 28 | 
      delay(65);  | 
  
| 29 | 
      rearServo.write(backTurnRightForward);  | 
  
| 30 | 
      delay(125);  | 
  
| 31 | 
      frontServo.write(centerTurnPos);  | 
  
| 32 | 
      delay(65);  | 
  
| 33 | 
      }
     | 
  
| 34 | 
       | 
  
| 35 | 
      void setup()  | 
  
| 36 | 
      {
     | 
  
| 37 | 
      frontServo.attach(2);  | 
  
| 38 | 
      rearServo.attach(3);  | 
  
| 39 | 
      }
     | 
  
| 40 | 
       | 
  
| 41 | 
      void loop()  | 
  
| 42 | 
      {
     | 
  
| 43 | 
      moveTurnLeft();  | 
  
| 44 | 
      }
     | 
  
- « Precedente
 - 1
 - 2
 - Successivo »