Arduino simple connection

i have a simple button connected to vvvv (via arduino).
if someone presses the button, in vvvv the rs232 recieves at OnData a bang.
this starts a video playing.
if you press the button again, the video pauses and seeks position 0.
after you pressed the button once, there is a stopwatch, that stopps 7 seconds until the button has any effect.

if the video is at the ending frame, it also pauses and seeks position 0.

the problem is, that if you press the button twice in short time, the 7second rule avoids the second pressing to have any effect. but still something unwanted happens: when the video arrives in this case at the ending frame, it seeks position 0 and PLAYS again. it should PAUSE here thougth.

i have no idea how to change that.
thanks for any tipps!

Florian

this is the aduino code:
{CODE(ln=>1)}

int ledPin = 13; // choose the pin for the LED
int inputPin = 2; // choose the input pin (for a pushbutton)
int val = 0; // variable for reading the pin status

void setup() {
pinMode(ledPin, OUTPUT); // declare LED as output
pinMode(inputPin, INPUT); // declare pushbutton as input
Serial.begin(9600);
}

void loop(){

val = digitalRead(inputPin); // read input value
if (val == HIGH) { // check if the input is HIGH
digitalWrite(ledPin, LOW);

Serial.print(“1”); // <-------- sendet eine “1” an VVVV wenn der knopf gedrückt wird

Serial.print(10); // ??
Serial.print(13); // ??

// turn LED OFF
} else {
digitalWrite(ledPin, HIGH); // turn LED ON
}
}
^

playknopf05.v4p (33.9 kB)

I don’t really get what you are wanting to achieve, sorry, it is not you but me ;)

Try and look to monoflop and flipflop.