Getting a signal to work?

Hi,
I have an Arduino UNO and a device connected to the Arduino across GND & digital pin 2. When I press the button on the device the output 13 on the Arduino momentarily pulses on while using the sketch DigitalInputPullup loaded. I just made some small changes:
Original code:
if (sensorVal == HIGH) {
digitalWrite(13, LOW);
}
else {
digitalWrite(13, HIGH);
}

Changed to:
if (sensorVal == LOW) {
digitalWrite(13, HIGH);
delay(13000);
}
else {
digitalWrite(13, LOW);
}

This is not what I’m after though, I’m looking for the output 13 to turn on and stay on until it receives another pulse from the device and then turns off. Pretty much what I’m looking for is how the debounce sketch functions, press button momentarily and led latches on, press it again led off.

The device I’m connected to does not function with a 10K connected to it so using the push button debounce configuration will not work. I rang the supplier of the device and he said it was some sort of square wave signal but he wasn’t sure!

This is why I need to do it in code only.

Any help would be greatly appreciated as I was supposed to have this sorted by tomorrow afternoon (GMT)

Cheers,
Ciaran

Hi All,
Found a solution here:

Cheers,
Ciaran