Étape 7: Programmation le Teensy
#include < Servo.h >
Roue mue
À l’aide de Teensy 3.0
par Mike Soniat
24/12/2012
Servo servo ;
int servoSpeed = 170 ;
int servoPin = 14 ;
int touchPin = 22 ;
int touchReading = 0 ;
isStarted booléen = false ;
void setup()
{
Serial.Begin(9600) ;
servo.Attach(servoPin) ;
}
void loop()
{
touchReading = touchRead(touchPin) ;
Si (touchReading > 3000)
{
isStarted =! isStarted ;
Delay(500) ;
}
Si (isStarted)
{
servo.Write(servoSpeed) ;
}
d’autre
{
servo.Write(0) ;
}
Delay(20) ;
}