02-10-2015 02:03 PM
I'm working on a project for a robotics class in which I have a robot that uses a light sensor to follow a line, and two color sensors that detect different colors on the sides of the line. The robot would use the input of the two color sensors to determine a note to play (For example, if it detects purple in one sensor and purple in the second sensor, it will play a C). However, I can't figure out how to make the robot play the note once it detects to color, hold the note until the color changes, then play the next corresponding note. How can i make my robot play a note, hold it until it is no lnoger on the color corresponding to the note, then stop playing the note immediately after moving off of that color, with negligible delay times?
02-18-2015 02:48 PM
Hi JPR7,
There's a few ways you could go about doing this. You can put a timer in your code to only allow the note to play for a certain amount of time before stopping. You could also use a state machine with a timer to allow the note to play for a certain amount of time before returning to a silent state until it needs to play the next note.
Here is a link to an example of using a state machine in LabVIEW: https://decibel.ni.com/content/docs/DOC-3116