Hide minor edits - Show changes to markup
Only your Arduino Espora is needed for this example. Connect the Esplora to your computer with a USB cable.
Only your Arduino Esplora is needed for this example. Connect the Esplora to your computer with a USB cable.
Connect the Esplora to your computer with a USB cable.
Only your Arduino Esplora is needed for this example.
Connect the Esplora to your computer with a USB cable.
Only your Arduino Espora is needed for this example.
Only your Arduino Esplora is needed for this example.
This example shows you how to read the values from the joystick. The output will be displayed through the serial monitor and as a color on the RGB LED.
This sketch blinks the Esplora's RGB LED. It goes through all three primary colors (red, green, blue), then it combines them for secondary colors(yellow, cyan, magenta), then it turns on all the colors to create white.
The joystick has two axes, X and Y. Each axis controls a color of the RGB LED: red with the X-axis, and green with the Y-axis. The brightness of the blue element will be controlled by the position of the linear potentiometer.
For best results, cover the LED with a piece of white paper to see the colors blend.
Each of these light's brightness is individually controllable with functions in the Esplora library:
To control all the colors with one instruction you use the writeRGB() function. It take three arguments. Each value represents the brightness of the red, green, and blue element, respectively. The brightness scales between 0 (for completely off) to 255 (for completely on).
After setting the brightness of an LED, use delay() to pause the sketch for a second, so the light stays in the state you left it.
It's also possible to control each light individually with the following functions :
If you want to control all the colors with one instruction you can use the writeRGB() function.
Moving the joystick and changing the position of the linear potentiometer will generate different values. These values are used to produce two different outputs: one will appear by opening the serial monitor, and the other is displayed physically through the RGB led.
(:source https://raw.github.com/arduino/Arduino/master/libraries/Esplora/examples/Beginner/EsploraBlink/EsploraBlink.ino lang=arduino tabwidth=4:)
(:source https://raw.github.com/arduino/Arduino/master/libraries/Esplora/examples/Beginners/EsploraBlink/EsploraBlink.ino lang=arduino tabwidth=4:)
Examples > Esplora
This example shows you how to read the values from the joystick. The output will be displayed through the serial monitor and as a color on the RGB LED.
The joystick has two axes, X and Y. Each axis controls a color of the RGB LED: red with the X-axis, and green with the Y-axis. The brightness of the blue element will be controlled by the position of the linear potentiometer.
(:div class=BOM :)
(:divend:)
Only your Arduino Espora is needed for this example.
joystick and slider to control the color of the RGB led on the Esplora
(:divend:)
The RGB LED is comprised of three colors that represent the three primary colors: red, green, and blue. Each of these light's brightness is individually controllable with functions in the Esplora library:
If you want to control all the colors with one instruction you can use the writeRGB() function.
Moving the joystick and changing the position of the linear potentiometer will generate different values. These values are used to produce two different outputs: one will appear by opening the serial monitor, and the other is displayed physically through the RGB led.
(:div class=code :) (:source https://raw.github.com/arduino/Arduino/master/libraries/Esplora/examples/Beginner/EsploraBlink/EsploraBlink.ino lang=arduino tabwidth=4:) (:divend:)