Knob
The knob is a device called a 'potentiometer'. It is a resistor whose resistance changes as you turn the knob. Resistance limits the electrical current that can flow through the circuit. The Arduino can measure the resistance, and then tell you what setting the knob is at.
Main Function
awesome.knob.reading()
Gets a position reading from the knob.
Returns
It returns an int
, which is the knob position between 0-1023. 0 means the knob is turned as far counter-clockwise as possible. 1023 means it is turned as far clockwise as possible.
Example
Advanced Function
awesome.knob.print()
First it takes a reading from the knob. Then it sends a message including this reading over the Serial connection.
Click the magnifying glass icon in the top right hand corner of the Arduino IDE to see the messages that Arduino sends to your computer through the Serial connection.
Example
Tips
This is a handy component to use when you want to manually change a value (think variable) in your sketch. For example, you could use it to adjust the brightness of the LED or the pitch of the buzzer.