Paso 7: Programación del Teensy
#include < Servo.h >
Overbalanced rueda
Con Teensy 3.0
por Mike Soniat
24/12/2012
Servo servo;
int servoSpeed = 170;
int servoPin = 14;
int touchPin = 22;
int touchReading = 0;
isStarted boolean = 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);
}
otra cosa
{
servo.Write(0);
}
Delay(20);
}