V. 01 – 12/04/2018 9 ©Velleman nv
for(char i=0; i<=3; i++)
{
digitalWrite(latchPin,LOW);
shiftOut(dataPin,clockPin,MSBFIRST,Dis_table[disbuff[i]]); //Send value to the 4 displays
shiftOut(dataPin,clockPin,MSBFIRST,Dis_buf[i] );
digitalWrite(latchPin,HIGH);
delay(2); //wait 2ms before accesing the next display, please try another value
(for example 100 ) to see how the multiplexing works
}
}
unsigned char ScanKey() //Scan push button 1 (S1)
{
if(Flag_up && digitalRead(KEY_ADD) == LOW)
{
Flag_up = 0;
display();
display();
if(digitalRead(KEY_ADD) == LOW)
{
return 1;
}
}
if(digitalRead(KEY_ADD) == HIGH)
{
Flag_up = 1;
}
return 0;
}
unsigned char ScanKey1() //Scan push button 2 (S2)
{
if(Flag_up1 && digitalRead(KEY_DEC) == LOW)
{
Flag_up1 = 0;
display();
display();
if(digitalRead(KEY_DEC) == LOW)
{
return 1;
}
}
if(digitalRead(KEY_DEC) == HIGH)
{
Flag_up1 = 1;
}
return 0;
}
void loop()
{