Page 1 of 1

२८) [5] Use the following sketch and hardware to darkin the leds that are lite up by the pot voltage setting Fill in mis

Posted: Fri Apr 29, 2022 8:23 am
by answerhappygod
 1
1 (23.89 KiB) Viewed 24 times
२८) [5] Use the following sketch and hardware to darkin the leds that are lite up by the pot voltage setting Fill in missing code in the following sketch
5V w A3 100 -W- + 2.56 jok POT GND N 3 4 $ -6 가 9 bit & A V ♡ ♡ 390} 390 ND
int analogPin int ledCount int ledPins void setup() { for (int led=0; led<=ledCount; led++) { pinMode(ledPins[led], OUTPUT); } }//end setup void loop() { int sensor analogRead(analogPin); int ledLevel = map (sensor,0, 1023,0, ledCount); for (int led=0; led<=ledCount; led++) { if (led ledLevel) { digitalWrite(ledPins[led], HIGH); } else { digitalWrite(ledPins[led], Low); } }//end for }//end loop