Turn on LEDs on Arduino

I am creating a game using openframeworks and arduino that involves the player “eating” fruit, where when the player moves over the fruit it disappears. When this happens I also have an arduino LED turn on. However, it does not turn off after the fruit disappears and remains on.

if (strawberryDistance < 75 ) {
	strawberryPos = ofVec2f(-100, 10000);
	score = score + 100;

	arduino.sendDigital(13, ARD_HIGH);
}

I have tried

else if (strawberryDistance > 75) {
	arduino.sendDigital(13, ARD_LOW);
}

and

else {
	arduino.sendDigital(13, ARD_LOW);
}

but both of these give me an error once the project runs.

Please let me know if there is any other way I can get the lights to turn off.

Thank you!

Which error?

It says debug assertion failed .

I assume you are using Firmata, right? Did the firmataExample work for you?

Did you upload the firmata code to the Arduino in advance?

Also, the interesting part of the error message is below the “Debug assertion failed” text. Here an example. It mentions the line number that provoked the error and “Expression: vector iterator not dereferencable”.

I was able to figure it out using a timer, thank you!