.. | ||
README.md | ||
robot.py |
12 - Digital and Analog Inputs
What is a Digital Input?
This is covered in slightly more detail in 8 - Basic Robot Electronics, but to reiterate, something that is digital will only ever have two states, on or off, 1 or 0.
Digital Inputs for robots will often times manifest themselves as various forms of switches, like buttons, toggles, etc.
What is an Analog Input?
Again, covered in slightly more detail in 8 - Basic Robot Electronics, but to reiterate, something that is analog can have many different values. For robot programming, this range is from 0 to 1, with every decimal number inbetween a different value that the potentiometer is providing (note that this would be different for other types of Analog Inputs, for this example, just focus on the 0 to 1 range).
Analog Inputs can manifest themselves as a lot of different things. This example shows off an Analog Potentiometer, a Potentiometer being something that turns that produces different analog values the more or less you turn it. Analog potentiometers are used for things like volume knobs and temperature controls.
How might I use these sorts of things for an Autonomous?
For a drive base exclusively, you probably wouldn't. Analog Potentiometers in particular wouldn't be very useful for just a drive base, but if you had an arm on your robot that you want to go to specific positions, you could use an analog potentiometer for that. You can use Digital Input buttons to detect if your robot has bumped into something, but in general this isn't super safe (for you or the button, depending on speed of travel).
The example I've provided is more to introduce you to some basic sensors before moving into the more complicated stuff. The basics of environmental interaction can be shown with this simple sensors without getting into too much complex code. Just remember that the use case you see here, isn't a common one.