Would anyone have any tips for sensor programming and testing? We’re trying to find the Optical sensor line tracking. Would anyone know to do this?
The optical sensors are digital (On/Off) devices. Wire them up to Robot Controller and sent the output to the Operator Interface LED
example:
out8 = rc_sw1 'optical sensor 1 wired to switch 1
out9 = rc_sw2 'optical sensor 2 wired to switch 2
Now you can see what the robot is seeing
Tim Tedrow
Line tracking is very simple. I can do it with one sensor and 5 lines of user code added to the default code. I hooked the white wire to rc_sw1(port one on the Digital Inputs) and used this code.
if rc_sw1 = 0 then
PWM1 = 137
PWM2 = 90
else
PWM1 = 90
PWM2 = 137
endif
This is the simplest way I can think of to do line tracking. The only problem is it is slow and it can lose the line with a bump or the sensor not reading right. I would recommend using at least two sensors to follow each side of the line.
Hope this helps.
make sure there is contrast between the floor and the tape (or whatever you’re tracking). i’ve tried a simple program, but it doesn’t work because of that reason. i think i’ve found a floor that works now though :).