I am fairly new to this robotics stuff and I try to keep ahead of my Civil Air Patrol Cadets as we progress through the VEX IQ system. I need some help please.
How do I program (using RobotC Graphical) the ClawBot to perform two or more functions simultaneously?
For example: I want the touch LED to flash at the same time the bot is moving.
Example: I want the robot to “beep” when it goes into reverse.
I can get the LED to flash, but not at the same time as movement.
I can get the bot to “beep”, but I need advice on how to integrate the commands to get the “beep” while moving in reverse.
Assuming I did it correctly, attached is a screen shot of what I have so far. I can get the LED to flash OR I get the arcade settings to work. I want the LED to flash WHILE the bot moves.
What is the secret sauce?
Not sure I can completely help, but you have two different repeat(forever) loops in series. If you run the program it will never see the second repeat loop. All commands must exist in the same **repeat(forever) **loop.
It might be possible to set a variable to getJoystick D and then test for less than 0 to play a sound, all inside the loop.
Commands would look like:
Variable[Value] used first to set the Variable “Joy”
Joy = getJoystickValue(ChD);
if (Joy , < 0) {playSound(soundWrongWay);}
See attached for Graphical RobotC example to include in your **repeat(forever) **loop.
ROBOTC Graphical is not really ideal for this. In the text version of the language, it is easy for 2 reasons. First, you have tasks so you can use a task to handle your reverse beeper. Secondly, you have more commands for the touch LED, one of which allows you to give the LED a blink time:
setTouchLEDBlinkTime(touchLED, X, Y) where X is the on time and Y is the off time. When you turn the LED on, it will handle it’s own blink cycles.
I can create you a basic example in ROBOTC text if you’d like?
This can be done roughly like how you’re doing it. You don’t have to switch over away from RobotC Graphical. The problem with the two repeat(forever) loops pointed out above is important. You want one repeat(forever) loop. Erase the second loop. Make a variable to record a time (lastRecordedTime below). Make another variable to record which color you’re on (basically, values 1, 2, and 3 or similar) (colorMarker below). Inside the first loop throw in a single if statement in addition to your arcade and arm controls. This would be the pseudocode:
Now the code will keep checking the time (getTimerValue()) as well as the joystick as it loops around. If enough time has passed since the last change, it will change the light to the next color, update which color will follow, and update the timer to check against the timer again.
OK… I have used this for a while and I never saw the setTouchLEDBlinkTime command… When I google it I can find a page but with no links. I have gone through a comprehensive list of the graphical commands, where is there a comprehensive list of the text commands? I don’t mind a big list.
But I haven’t found the path to them, and they don’t have links backward. But I was able to get a whole pile of links to various commands with the LED using this search on Google:
robotc TouchLED site:help.robotc.net
I’m sure just a few replacements for “TouchLED” would provide quite a few commands.