i´ve just started using arduino by myself, i´m tryng to make a buzzer act in diferent ways as i use a sensor to sum a variable, so when the variable is < 5 acts in a way but if it is 5 or more the buzzer acts in another way but i got no results
Acabo de empezar a usar arduino por mi cuenta, estoy intentando hacer que un zumbador actúe de diferentes maneras, ya que utilizo el sensor para sumar a la variable, de modo que cuando la variable es <5 actúa de una manera, pero si es 5 o más, zumbador actúa de otra manera, pero no obtengo algún resultado
int animo=5;
int T = 1;
void setup()
{
pinMode(5, OUTPUT) ;
pinMode(1, OUTPUT);
pinMode(T, INPUT);
}
void loop()
{
digitalRead( T);
if (T = HIGH)
animo = animo +1;
do {
tone(1,261,500);
delay(1000);
delay(1000);
tone(1,261);
delay(1000);
delay(1000);
} while (animo <= 4);
do {
tone(2,261,500);
delay(1000);
delay(1000);
tone(2,261,500);
delay(1000);
delay(1000);
} while (animo >= 5);
delay(3000);
animo = animo - 3;
}
i conect the buzzer to pin 1 and 2 then to ground
the sensor is conected to pin 3
conecto el zumbador al pin 1 y 2, de ahi a tierra
el sensor va a pin 3