Life as we know it isn’t all yes or no, or just black or white. There are many shades of gray. For the robot to sense and deal with the areas in between, we use analog sensors.
Analog sensors are plugged sensor ports 0-7 on the CBC v.2. There are two functions that can be called to retrieve data from the analog sensors:
- One – the analog() function – has an 8-bit resolution and returns a value between 0 and 255.
- The other – the analog10() function – has a 10 bit resolution and returns a value between 0 and 1023.
On the Link controller, the emphasis have been placed upon 10 bit resolution thus the analog() function returns values from 0 to 1023, but you can still get 8 bit resolution by calling analog8() to return a value betwwen 0 to 255.
The higher the number, the higher the resolution or sensitivity, but it also takes more processing power. Furthermore, some sensors may have noise which is more than the resolution of analog10(), so the added sensitivity can’t be used.