Hello everyone, I'm new on programming. I've bought a MUX Shield 2 and i'm trying to know how to use it for a 7-seg counter.
An example of what I want:
int p = 2; //pushbutton
int val = 0; //value pushbutton
int ant = 0; //previous state of pushbutton
int c = 0; //counter
int L1 = 13; // to "a" of decoder 7448
int L2 = 12; // to "b" of decoder 7448
int L3 = 11; // to "c" of decoder 7448
int L4 = 10; // to "d" of decoder 7448
void setup ( )
{
pinMode ( L1, OUTPUT );
pinMode ( L2, OUTPUT );
pinMode ( L3, OUTPUT );
pinMode ( L4, OUTPUT );
pinMode ( p, INPUT );
}
void loop ( )
{
val = digitalRead ( p );
if ((val == HIGH)&&(val != ant)&&(c < 9))
{
c++;
delay (250);
}
ant = val;
if (c==0)
{
digitalWrite (L1, LOW);
digitalWrite (L2, LOW);
digitalWrite (L3, LOW);
digitalWrite (L4, LOW);
}
if (c==1)
{
digitalWrite (L1, HIGH);
digitalWrite (L2, LOW);
digitalWrite (L3, LOW);
digitalWrite (L4, LOW);
}
I want to transform this program to MUX SHIELD 2 program (I'll apreciate if you explain me the basic functions of the shield becouse I can't find any tutorial on the internet)