#include <SPI.h>
#define SW1PIN (3)
#define SW2PIN (4)
#define SW3PIN (5)
#define DIGIT1PIN (6)
#define DIG2T1PIN (7)
#define DIG3T1PIN (8)
#define DIG4T1PIN (9)
#define DECODE1PIN (10)
#define DECODE2PIN (10)
#define DECODE3PIN (10)
#define DECODE4PIN (10)
int hour, minute,second;
unsigned long cur_time, last_time;
void setup()
{
hour = 0;
minute = 0;
second = 0;
pinMode(SW1PIN,INPUT);
pinMode(SW2PIN,INPUT);
pinMode(SW3PIN,INPUT);
Serial.begin(9600);
SPI.begin();
last_time = millis() + 1000;
delay(100);
}
void loop()
{
if(digitalRead(SW1PIN) == LOW) {
Serial.println("SW1 ..");
}
if(digitalRead(SW2PIN) == LOW) {
Serial.println("SW2 ..");
}
if(digitalRead(SW3PIN) == LOW) {
Serial.println("SW3 ..");
}
cur_time = milis();
if(cur_time < last_time) return;
last_time = cur_time + 1000;
second = second + 1;
if(second > 60) {
minute = minute + 1;
second = 0;
if(minute > 60) {
hour = hour + 1;
minute = 0;
}
}
}