Assignment 10.1
Post date: Jul 17, 2010 3:48:46 AM
For this one I used a potentiometer connected to analog pin 1 to control the brightness of an LED connected to digital pin 9.
Here's my code:
int val = 0;
int ledPin = 9;
int potPin = 1;
void setup() {
//twiddle your thumbs
}
void loop() {
val = analogRead(potPin);
val = map(val, 0, 1023, 0, 225);
analogWrite(ledPin, val);
delay(30);
}
Here's a Fritzing pic of my circuit: