Dear all:
Im working on a project that requieres the use of the DECADE counters CD4026.
It is a project in which a button will be activated when pepople steps on it. Depending on the area it will activate differnt buttons. Those are read by Arduino, and it send a clean pulse t the CD4026 counter. It has also a TOTAL count in which im having problems:
I dont know where is the piece of programming that sends a lot of pulses to the total with every push of the button.
Ill attatch a couple of videos.
Attatched is the basic Schamatic
Here it is how it DOESNT work (top right corner is the total count)
and the coode i have is:
const int bot0 = A0;
const int bot1 = A1;
const int bot2 = A2;
const int con0 = 6;
const int con1 = 3;
const int con2 = 1;
const int total = 0;
const int buzz = 8;
void setup()
{
pinMode(bot0, OUTPUT);
pinMode(bot1, OUTPUT);
pinMode(bot2, OUTPUT);
digitalWrite(bot0, HIGH);
digitalWrite(bot1, HIGH);
digitalWrite(bot2, HIGH);
digitalWrite(total, LOW); //i have changed tried delating this but still not working
pinMode(con0,OUTPUT);
pinMode(con1,OUTPUT);
pinMode(con2,OUTPUT);
pinMode(total,OUTPUT);
}
void loop ()
{
if(digitalRead(bot0) == LOW) //read button 0. Increase counter0 one and increase total
{
digitalWrite(con0, HIGH);
digitalWrite(total, HIGH);
}
else
{
digitalWrite(con0, LOW);
digitalWrite(total, LOW);
}
if(digitalRead(bot1) == LOW) //read button 1. Increase counter 1 and total
{
digitalWrite(con1, HIGH);
digitalWrite(total, HIGH);
}
else
{
digitalWrite(con1, LOW);
digitalWrite(total, LOW);
}
if(digitalRead(bot2) == LOW) ///read button 2. Increase counter 2 and total
{
digitalWrite(con2, HIGH);
digitalWrite(total, HIGH);
}
else
{
digitalWrite(con2, LOW);
digitalWrite(total, LOW);
}
}
When I remove the other buttons in the program, it works perfectly:
const int bot0 = A0;
const int bot1 = A1;
const int bot2 = A2;
const int con0 = 6;
const int con1 = 3;
const int con2 = 1;
const int total = 0;
void setup()
{
pinMode(bot0, OUTPUT);
pinMode(bot1, OUTPUT);
pinMode(bot2, OUTPUT);
digitalWrite(bot0, HIGH);
digitalWrite(bot1, HIGH);
digitalWrite(bot2, HIGH);
digitalWrite(total, LOW);
pinMode(con0,OUTPUT);
pinMode(con1,OUTPUT);
pinMode(con2,OUTPUT);
pinMode(total,OUTPUT);
}
void loop ()
{
if(digitalRead(bot0) == LOW) //
{
digitalWrite(con0, HIGH);
digitalWrite(total, HIGH);
}
else
{
digitalWrite(con0, LOW);
digitalWrite(total, LOW);
}
Im sure it could be something easy but I still cant figure it out. If someone has any recomendation, let me know.
Thanks