Turns on/off and adjusts brigthness of 3 LEDs
/*
* AnalogInput
* by DojoDave <http://www.0j0.org>
*
* Turns on/off and adjusts brigthness of 3 LEDs connected to digital
* pins 9,10, and 11. The amount of time the LED will be on/off and the brigthness depends
* on the value obtained by analogRead(). Pots are connected to analog pins 1 and 2.
*
*/
// select input pin for potentiometers
/*
* one pot controls brightness another how fast the leds blink.
* modified version of AnalogInput
* by DojoDave <http://www.0j0.org>
* http://www.arduino.cc/en/Tutorial/AnalogInput
*/
int blinkPotPin = 1; // select the input pin for the potentiometer to control blink
int brightPotPin = 0; // select the input pin for the potentiometer to control brightness
int redPin = 9; // select the pin for the LEDs
int greenPin = 10;
int bluePin = 11;
First assignment:
Code allows to control the intensity of three LEDs using three potentiometers. RGB Values are sent to the serial monitor for debugging.
Description:
This code users two potentiometers to control three LEDS. Twisting one pot "moves" the light along the LEDS in a direction parallel to the direction of turning. Twisting the other pot adjusts the brightness of of the LEDs.
Materials:
Arduino Code:
/*
* The Rainbow-Strobe
*
* Using the three potentiometers it is possible to
* 1. change the color in the rainbow spectrum (red-orange-yellow-green-blue-purple-red)
* 2. modify the brightness
* 3. control the strobe effect
*
* Theory and Practise of Tangible User Interfaces
* Lab Assignment 3
*
* Martin Kiechle
* 9/20/2011
*/
/*
* variables and allocations
*/
Components
1x potentiometer (soldered)
1x potentiometer (solderless)
2x led, 2x 330 ohms
1x breadboard, 1x arduino
Source code
Using potentiometer to change the resistance of voltage sent to the LED gives a range that takes advantage of analog INPUT.
Description
Using two potentiometers we control the LEDs rate of blinking and range of brightness.
Materials
LEDs
Potentiometers
Breadboard and fixin's
Code
Here's the code i made/adapted, after soldering the pots, and connecting to analog.