
//-----------  Serial send  button press from Arduino -------------
//  Setup:   Wire a button between pin 5 and Gnd
//------------------------------------------------------------
int buttonPin = 5;     // which pin is attached to the switch
boolean switchState;   // boolean (HIGH or LOW) variable for state of switch

void setup() {      
  pinMode(buttonPin, INPUT_PULLUP); // enable "pullup resistor"   
  Serial.begin(9600);            // start serial port at 9600 bps:
}
void loop()  {     
    switchState = digitalRead(buttonPin); // Check the state of button
    if(switchState == LOW) {              // Switch is closed if connected to Ground
    Serial.println("1");                  // Send message to serial (USB)
    delay(120);
    } else {                              // Else, switch is open. "Tied high"
    Serial.println("0");         // Send message to serial (USB) 
    delay(100);                           // Longer delay between tones
    }
}


