// constants won't change. They're used here to
// set pin numbers:
int buttonPin = 3; // the number of the pushbutton pin
int ledPin = 8; // the number of the LED pin
int buttonState; // the current reading from the input pin
int lastButtonState = LOW; // the previous reading from the input pin
void setup() {
// Set initial pin states, and turn on the LED
pinMode(buttonPin, INPUT_PULLUP);
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, HIGH);
}
void loop() {
// Read the state of the switch into a local variable.
int reading = digitalRead(buttonPin);
// if the button state has changed:
if (reading != buttonState) {
buttonState = reading;
// If the new button state is HIGH, that means the button
// has just been pressed.
if (buttonState == HIGH) {
// Send a message to the plugin activating the Stage
// action group. The plugin will then activate the
// next stage.
}
}
// Set the LED to match the state of the button.
digitalWrite(ledPin, buttonState);
// save the reading. Next time through the loop,
// it'll be the lastButtonState:
lastButtonState = reading;
}