Monday, 7 December 2015

Arduino Challenge 4

Challenge Name
25%, 50
% 75% 100%!

Author
Joshua Mac

Credit
Aron Graca
Kyle Chan

Difficulty Level (1-5)
3

Time To Complete
15 mins\

Challenge DescriptionMake a circuit with LEDs in a row. The LEDs will light up one at a time in proportion with how far the potentiometer is twisted.

                              
Answer:
int sensorPin = A0;
int ledPin1 = 13;
int sensorValue = 0;
void setup()
 {  
pinMode(ledPin1, OUTPUT);
pinMode(sensorValue, INPUT);
}
void loop()
 {
 sensorValue = analogRead(sensorPin);
 digitalWrite (ledPin1, sensorPin);
 }

 

No comments:

Post a Comment