Re: Need help programming simple function
Never mind, I solved the problem in NXT-G. I found this count-function as a start: http://www.brickshelf.com/gallery/brdav ... resses.png
I made my own additions so it now looks like this.
- I added the C-motor to see if the program ended where I wanted it to.
- The two "Logic 1" blocks at the end of the top loop writes "false"
- To make the count function work with the ultrasonic sensor, I added a "wait for Sensor > 22 cm"
- The loop for the count-function is 6 seconds.
- The "Greater than or equal" block says that "number 1" should be greater than 0.
It works perfectly. I tested it multiple times.
Would be awesome seeing it in RobotC though to get the language refreshed