Ok well then that's good to read, I guess Im just doing something wrong on that.
as a test i did this to see if i can even get a serial monitor message but no luck.
// constants won't change. They're used here to set pin numbers:
const int SW = 2; // the number of the pushbutton pin
const int LED = 13; // the number of the LED pin
const unsigned long Debounce = 20;
unsigned long ButtonStateChangeTime = 0; // Debounce timer
boolean ButtonWasPressed = false;
void setup() {
//SET PINS:
pinMode(SW, INPUT);
//Set SW pin to HIGH to monitor state.
digitalWrite(SW, HIGH);
//RESET BACK TO EFFECT BYPASS AFTER START UP:
Serial.begin(9600);
Serial.println("Start");//DEBUGGING
}
void loop(){
unsigned long currentTime = millis();
boolean buttonIsPressed = digitalRead(SW) == LOW; // Active LOW
// Check for button state change debounce.
if (buttonIsPressed != ButtonWasPressed &&
currentTime - ButtonStateChangeTime > Debounce) {
// Button state has changed.
ButtonWasPressed = buttonIsPressed;
if (ButtonWasPressed) {
void button();
}
//Time reset.
ButtonStateChangeTime = currentTime;
}
}//End Main Loop.
void button(){
Serial.println("Press");
}//Loop 2 End.
debounce in the main loop and then move on to the other loop. no message though.