Go Down

Topic: inglish/español Help whith sums and a buzzer/ ayuda con sumas y un Zumbador (Read 187 times) previous topic - next topic

Ryol

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
Code: [Select]
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

TomGeorge

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

What model Arduino are you using, if a UNO, Pins0 and 1 are used for programming the UNO, so you need to avoid usig them.

Thanks.. Tom.. :)
Everything runs on smoke, let the smoke out, it stops running....

Ryol

Hi, I made an image of how I conected my arduino Uno.
Also I corrected the pins,

TomGeorge

Ops  circuit????

That makes no sense what so ever.  :o :o :o


A picture of a hand drawn circuit in jpg, png    would be better and a picture of your project so we can see your component layout.


Quote
i use a sensor to sum a variable,
What sensor, what variable?

Tom.... :)
Everything runs on smoke, let the smoke out, it stops running....

Go Up