In our case, we plugged the LED into Digital 4. After inserting ’ turnLEDOn(dgtl4); ’ into our teleoperated code, we received the following error -
Error:Undefined procedure ‘turnLEDOn’.
After searching around for a while, I found no topics on Vex Forum concerning this error. Has anyone else had this happen or used these LED’s in the past and ran into similar issues? I’m sure we’re just missing something obvious at this point.
Whenever I use the LEDs, I just use this, which seems to work:
SensorValue[dgtl4] = 0;
which should turn it on, and = 1 should turn it off. Note that we’re only using one equal sign to assign a value rather than check if it equates (which is ==).
Hopefully that helps, I dunno how clear I was when trying to explain.
It appears that you’re looking at the documentation for Natural Language - this is not the setting that RobotC is set to by default. You CAN turn RobotC to Natural Language, but I wouldn’t recommend it if you’ve already been using normal RobotC.
Yes, these are natural language functions and are simply wrappers for SensorValue. This is the relevant code from the natural language header file for VEX (although they look backwards to me, ie. lenOn should be 0).
This issue seems more complicated than it should be, so I’m back to ask the code vexperts a few more questions.
The robot currently has a 2-wire extension wire plugged into the correct red & black pin ports. This wire is plugged into digital 4, and the LED is plugged into the 2-wire extension. Whenever the robot is turned on, the LED immediately lights up.
We tried changing the sensor type from VEX LED to Digital Out as suggested, but we have the same results - LED is always on regardless of the limit switch being pressed.
As I recall, the LED is not plugged into the black and red wires, as they are just ground and +5V. The LED should be plugged into the black and white wires, which are ground and signal respectively.
Hmm, I plug them into signal and +5V (white and red), I don’t think the VEX leds can be plugged into black and white as they use two adjacent pins, I only have home brew ones so would need to check on that. When the signal goes low then led should light. There is a 1K series resistor (from what I remember) in the signal line to limit current. RobotC may invert the logic so you need to experiment.
You guys are great, moving the 2-wire connector did the trick. I should have read the LED specs a little more closely, but this is our first time trying to use them for driver feedback purposes. We’ll get a video up soon & will make sure to document this for anyone else that has issue with them in the future. Thanks again for the help!