#include const int buttonPin = 7; // the number of the pushbutton pin const int ledPin = 8; // the number of the LED pin SoftwareSerial mySerial(0, 1); // RX, TX // Variables will change: int ledState = HIGH; // the current state of the output pin void setup() { mySerial.begin(115200); pinMode(buttonPin, INPUT_PULLUP); pinMode(ledPin, OUTPUT); } int cols[] = {97,98,99,100,101}; int selected = 0; int BLOCK_TIME = 250; int DEBOUNCE_TIME = 50; void loop() { // read the state of the switch into a local variable: int reading = digitalRead(buttonPin); //button pressed if (reading == LOW) { delay(DEBOUNCE_TIME); if (reading == LOW) { selected = (selected + 1) % 5; mySerial.write(selected); if (ledState == HIGH) ledState = LOW; else ledState = HIGH; digitalWrite(ledPin, ledState); delay(BLOCK_TIME); } } }