Movimento » gogogogo.ino
| 1 |
/*
|
|---|---|
| 2 |
Progetto : Insetto Robot - HackLab Terni
|
| 3 |
Andatura in avanti
|
| 4 |
Luglio 2012
|
| 5 |
Autore : Cristina Begliomini
|
| 6 |
*/
|
| 7 |
#include <Servo.h>
|
| 8 |
|
| 9 |
Servo frontServo; |
| 10 |
Servo rearServo; |
| 11 |
int centerPos = 90; |
| 12 |
int frontRightUp = 72; |
| 13 |
int frontLeftUp = 108; |
| 14 |
int backRightForward = 75; |
| 15 |
int backLeftForward = 105; |
| 16 |
void moveForward() |
| 17 |
{
|
| 18 |
frontServo.write(frontRightUp); |
| 19 |
rearServo.write(centerPos); |
| 20 |
delay(65); |
| 21 |
rearServo.write(backLeftForward); |
| 22 |
delay(125); |
| 23 |
frontServo.write(centerPos); |
| 24 |
delay(65); |
| 25 |
frontServo.write(frontLeftUp); |
| 26 |
rearServo.write(centerPos); |
| 27 |
delay(65); |
| 28 |
rearServo.write(backRightForward); |
| 29 |
delay(125); |
| 30 |
frontServo.write(centerPos); |
| 31 |
delay(65); |
| 32 |
}
|
| 33 |
|
| 34 |
void setup() |
| 35 |
{
|
| 36 |
frontServo.attach(2); |
| 37 |
rearServo.attach(3); |
| 38 |
}
|
| 39 |
|
| 40 |
void loop() |
| 41 |
{
|
| 42 |
moveForward(); |
| 43 |
}
|
- « Precedente
- 1
- 2
- Successivo »