Slider Add-On
The slider is a device called a 'potentiometer'. It's a lot like the knob! It is a resistor whose resistance changes as you move the slider. The Arduino can measure the resistance, and then tell you what setting the slider is at.
Main Function
awesome.port1.slider.reading()
Gets a position reading from the slider.
Returns
It returns an int
, which is the slider position between 0-1023.
Example
// Turns the LED on if slider setting is greater than 500
if ( awesome.port1.slider.reading() > 500 ) {
awesome.LED.turnOn();
}
Advanced Function
awesome.port1.slider.print()
First it takes a reading from the slider. 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 you through the Serial connection.
Example
// prints a reading from the slider over the serial connection
awesome.port1.slider.print();
Tips
This is a handy component to use when you want to manually change a value in your sketch. Try using it to dim the brightness of your LED!