Hi,
I need a bit of help (information) with the code for the start here robot.
What does "readadc" mean.... what is this referring to?
and when it says "readadc 1, b1" .... is this referring to pin locations?
I'm just missing something here? I'm not all that familiar with programming
so... i'm sure this is (obviously) a real beginner's question.
Thanks for the help.
John
Manuals
Please confirm what I am saying by checking into ADC’s in “Getting started” manual 1 and “Commands” manual 2.
An ADC is an analog input. It reads analog values from things that spit-out analog values. In this case, it is READ the ADC on PIN 1 and store the number you get in variable B1. This is used to read your sharp sensor. When the sharp sensor reads a distance, it varies the voltage coming out of its output and the voltage level represents the distance that it is reading. As something gets closer, the voltage goes up. The ADC channel reads this voltage level and changes it into a number between 0-255. That number gets put into variable B1 so you can use it elsewhere in the code. Note: The picaxe can also read ADC10 which is a 10-bit value and thus the number goes from 0-1024. Everything else is the same, it is just more accurate. For what you are doing, just assume it will always be a byte value, 0-255.
I’m serious about those manuals, now.
Thank you, Chris, for the explanation…
When I read your comment… it dawned on me, what Frits wrote in the programming section… main: readadc 0, b0 debug gotomain… I now see what that is all about. That the sensor is reading distances and that variable is showing up in b0. Click!
I have the David Lincoln book, programming and customizing picaxe… which further explained the readadc feature…
thank you for the help.
Now I have to figure out why my robot’s sensor is looking side to side, turning 30 degrees and then…just repeating that sequence… and not driving forward.