usar servo con botones
TRANSCRIPT
-
7/21/2019 Usar Servo con botones
1/1
#include Servo miServo;int boton1=LOW;int boton2=LOW;int boton3=LOW;int Grados=0;
void setup(){ miServo.attach(5); Serial.begin(9600); pinMode(11,INPUT); pinMode(9,INPUT); pinMode(10,INPUT);}void loop (){boton1=digitalRead(10);boton2=digitalRead(9);boton3=digitalRead(11);
if (boton1==HIGH && boton2==LOW && boton3==LOW){Grados=Grados+20;}
if (boton1==LOW && boton2==HIGH && boton3==LOW ){ Grados=Grados-20;}if (boton1==LOW && boton2==LOW && boton3==HIGH){Grados=0;}miServo.write(Grados);
}