Experiment 2 challenge: potentiometer
I'm officially stuck here. This is the code and I just modified it to add another int and led on 12. The light turns but the potentiometer does not apply to the other light..
UPDATE: got both blinking lights and both of them reading from the meter. Had to add a delay part of it to adhere to the digital write ledpin2 i had.
Explanation in the video.
3 led lights working with the meter.
CODE
int sensorPin = 0;
int ledPin = 13; int ledPin2=12; int ledPin3=11;
void setup()
{ pinMode(ledPin, OUTPUT); pinMode(ledPin2, OUTPUT); pinMode(ledPin3, OUTPUT); }
void loop()
{ int sensorValue;
sensorValue = analogRead(sensorPin);
digitalWrite(ledPin, HIGH);digitalWrite(ledPin2, HIGH); digitalWrite(ledPin3, HIGH);
delay(sensorValue); delay(sensorValue); delay(sensorValue);
digitalWrite(ledPin, LOW);digitalWrite(ledPin2, LOW); digitalWrite(ledPin3, LOW);
delay(sensorValue);delay(sensorValue); delay(sensorValue); }
Time for a break!
Comments
Post a Comment