The Robot Framework with Game Code has code in Autonomous Independent to read the line sensors and follow the line. However, the DIO ports are never opened. The solution is to open them in begin and add them to the refnum registry.
Yeah… a bit of a gotcha. BTW, if you are just using the light sensors in Auto, it’s actually a lot easier just to open them right there before the loop and save the effort of storing and retreiving the refnums.
Without verifying it… I also think that the code assumes that the Normally Closed outpts from the sensors are used. When I ran the program for the first time with the Normally Open outputs wired, the LED on the “Line” was off, and the other two were on.
Just mentioning it so that anyone using this code checks that the LEDs on the AutoIndependant Front Panel are correct. The LED should ligt up when the sensor is OVER the line. I think we may need to throw in an inversion.
I also think for testing it will be easier to move this code to the TELEOP VI and engage it when you press a Joystick button. eg: Left button to stay on the left side of the line, right button to stay on the right side.
This way it’s easier to just let go the button to turn off tracking, and drive back into position
Follow Up:
Yes, as suspected the Auto Code assumes N/C outputs on the Line sensors.
So, if you wire the Black output wire to the Digital Sidecar, you will have to invert the sensor inputs before they are combined into a index value for the case structure.
If you haven’t wired them yet… make sure you use the following wiring:
Sensor Brown +12V
Sensor Blue 0V GND
Sensor White Digital Sidecar Digital In (White PWM wire)