
PRO
RoboHappy
USA
Asked
— Edited
Im a little confused here. I'm simply trying to read the value coming from my IR sensor (one of the Sharp IR ones). The script I wrote should should be a simple loop and display the value, can continue to display the value until I tell it to stop.
goto(sensor)
:sensor
$IRSensor = GetADC(ADC4)
# Sharp IR Sensor
print($IRSensor)
sleep(1000)
Return()
It seems to run only a couple of times then stops. That's my issue, why it displays the values twice then stops. What am I missing? confused
Hi, RoboHappy. Why are you using the analog ports for the bumpers. It is a simple 1 or 0 contact, use the digital ports and save the analog for future use. Regards.
@proteusy That is true, I could use the digital ports. At least now I could since I've ported all the servos over to the SSC32 and in fact freed up the digital ports. At the time I did not have any more ports left except the adc, so wanted to learn best way to use with the switches since I've seen it done before on the forums earlier. I still may do the digital route again, but for now I'm sticking with the adc, and the best, for me, at least it is getting some more programming experience out of it the best part with the help of this great community here.