unsigned long time;
unsigned long time2;
void setup() {
pinMode(2, INPUT);
pinMode(3, INPUT);
attachInterrupt(0, buttonB, RISING); //If buttonB is pressed, trigger interrupt 0
attachInterrupt(1,buttonA,RISING); //If buttonA is pressed, trigger interrupt 1
Serial.begin(9600);
}
void loop() {
digitalWrite(LED_BUILTIN, LOW);
delay(500);
digitalWrite(LED_BUILTIN, HIGH);
delay(500);
}
void buttonB() {
time = micros(); //checks the micros time when button b is pressed
Serial.print("Time in Micros: ");
Serial.println(time); //Prints the time in micros
delay(1000);
}
void buttonA() { //checks the millis time when button A is pressed
time2 = millis();
Serial.print("Time in Millis: ");
Serial.println(time2); //Prints the time in millis
delay(1000);
}