Knob

Knob Knob 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

// Turns the LED on if light level is greater than 500 if ( awesome.knob.reading() > 500 ) { awesome.LED.turnOn(); }

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

// print a knob reading over the Serial connection awesome.knob.print();

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.

x

Goodbye and thanks for all the fish,

Thanks for helping us Kickstart Awesome Shield and learning with us. Sadly, turning Awesome Shield into a sustainable business didn’t work out and so we’re in the process of officially shutting down the company.

Read our full letter.

If you have an Awesome Shield you can keep using it and the learning platform.


Close Message