Here is the current code. It is working perfectly. I only have 1 switch set up so far. how do i get the arduino to stop sending the string after the delay in the loop? i want to be able to leave the switch on but if i do the loop sends the command again and winamp starts playing the song from the beginning.
/*
* Emergency Party Button
* Sends serial commands to the program gobetwino through serial port
*/
int inputPin1 = 5; // sets the input pins
int inputPin2 = 6;
int inputPin3 = 7;
int inputPin4 = 8;
int val = 0; // variable for reading the pin status
void setup() {
Serial.begin(9600);
pinMode(inputPin1, INPUT); // declares pushbuttons as input
pinMode(inputPin2, INPUT);
pinMode(inputPin3, INPUT);
pinMode(inputPin4, INPUT);
}
void loop(){
val = digitalRead(inputPin3); // read input value
if (val == HIGH) { // check if the input is HIGH
Serial.println("#S|LEVEL1|[]#"); // send command by serial port
delay(1000);
}
}