Modkit Self-Driving Car Red Light Green Light

I’m having my student work on a self-driving car project and he is working on a program that allows his car to detect red lights for stopping and green lights for moving forward. This is the code we tried at first and it did not work. When downloading the program to the robot, it mentioned an error concerning the “stop” command. If we change the “stop” to a “drive REV 1 mm”, it goes reverse 1 mm as it should. We’re not sure why it’s not stopping when the color sensor detects a red light. Any ideas?


Would seem to me that it might work if you grouped the commands into one loop. See attached suggestion.

It would help if you could list the exact error message.


It says “Error message: reference to ‘stop’ is ambiguous” for my code and your code.

Stop is most likely a reserved word in Modkit, its the software’s way of saying you can’t use it.

“stop” is actually one of the Modkit elements that can be dragged into the screen.

Apologies, I thought you meant you had used a broadcast or variable somewhere called stop.

@cmendoza Can you upload the actual Modkit file, it will be easier to diagnose.

When I go to upload the file to this forum, I get an error saying that it is an invalid file. I don’t think this forum allows the attachment of modkit/mk4v files.

Ironic isn’t it?
You’ll need to put it inside a zip file.

Thanks for the tip. (1.21 KB)

Sorry for the slow reply @cmendoza
The file must have just become corrupt. There is nothing wrong with the program itself and if recreated on a new template, it is absolutely fine. I have no idea how it has happened and I can’t seem to fix it, but the syntax is fine so just recreate it on a blank program.

Thank you.