Author: Christina He
Credit: New Innovators.ca Lab 4
Difficulty Level: Level 2
Time to Complete: Approximately 30 min
Challenge Description: Make one LED to blink with different levels of brightness by twisting the potentiometer.
Answer:
Code
int ledPin = 13;
int value = 0;
void setup()
{
pinMode (ledPin , OUTPUT);
pinMode(sensorPin, INPUT);
}
void loop()
{
value = analogRead(sensorPin);
analogWrite(ledPin , value);
delay(100);
}
Visual Answer
No comments:
Post a Comment