unsigned long time1=0;
unsigned long time2=0;
bool switch_Status = false;
//boolean outHigh = false;
//boolean outLow = false;
void setup() {
// put your setup code here, to run once:
pinMode(3, OUTPUT);
pinMode(10, INPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
Serial.print("Switch : ");
switch_Status = digitalRead(10);
Serial.println(switch_Status);
if(switch_Status) // switch_Status == HIGH
{
time1=millis();
}
else
{
time2=millis();
}
Serial.print("time1 : ");
Serial.print(time1);
Serial.print(" time2 : ");
Serial.print(time2);
Serial.print(" 1,2 differance : ");
Serial.print(time2 - time1);
Serial.print(" differance1 : ");
Serial.print(millis() - time1);
Serial.print(" differance2 : ");
Serial.print(millis() - time2);
}