Instruction: Create a code for an increasing value of LDR. When the value output of LDR is 75% and above all the LED will turn on. If the value output of LDR is 50% to 74% only 4 LED will turn on. If the value output of LDR is below 50% only 2 LED will turn on. P.S: I already made a code *refer to the photo below* but there is some mistake that I cannot determine.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

InstructionCreate a code for an increasing value of LDR. When the value output of LDR is 75% and above all the LED will turn on. If the value output of LDR is 50% to 74% only 4 LED will turn on. If the value output of LDR is below 50% only 2 LED will turn on.

P.S: I already made a code *refer to the photo below* but there is some mistake that I cannot determine.

 

int LDR = A0;
int led1 = 12;
int led2 = 11;
int led3 = 9;
int led4 = 8;
int led5 = 7;
int led6 = 6;
if (percentVal >= 75) {
digitalWrite(12,HIGH);
digitalWrite(11,HIGH);
digitalWrite(9,HIGH);
digitalWrite(8,HIGH);
digitalWrite(7,HIGH);
}
int val = 0;
int percentVal;
if (percentVal >=50 && percentVal
<75) {
void setup() {
Serial.begin(9600);
pinMode(A0,INPÚT);
digitalWrite(11,HIGH);
digitalWrite(9,HIGH);
digitalWrite(8,HIGH);
digitalWrite(7,LOw);
digitalWrite(6,LOW);
}
pinMode(12,OUTPUT);
pinMode(11,0UTPUT);
pinMode(9,0UTPUT);
pinMode(8,0UTPUT);
pinMode(7,0UTPUT);
pinMode(6,0UTPUT);
}
if (percentVal <50) {
digitalWrite(12,HIGH);
digitalWrite(11,HIGH);
digitalWrite(9,LO%);
digitalWrite(8,LOW);
digitalWrite(7,LOW);
digitalWrite(6,LOW);
void loop() {
val = analogRead(A0);
percentVal = (val)*iooí(694);
Serial.print(percentVal);
Transcribed Image Text:int LDR = A0; int led1 = 12; int led2 = 11; int led3 = 9; int led4 = 8; int led5 = 7; int led6 = 6; if (percentVal >= 75) { digitalWrite(12,HIGH); digitalWrite(11,HIGH); digitalWrite(9,HIGH); digitalWrite(8,HIGH); digitalWrite(7,HIGH); } int val = 0; int percentVal; if (percentVal >=50 && percentVal <75) { void setup() { Serial.begin(9600); pinMode(A0,INPÚT); digitalWrite(11,HIGH); digitalWrite(9,HIGH); digitalWrite(8,HIGH); digitalWrite(7,LOw); digitalWrite(6,LOW); } pinMode(12,OUTPUT); pinMode(11,0UTPUT); pinMode(9,0UTPUT); pinMode(8,0UTPUT); pinMode(7,0UTPUT); pinMode(6,0UTPUT); } if (percentVal <50) { digitalWrite(12,HIGH); digitalWrite(11,HIGH); digitalWrite(9,LO%); digitalWrite(8,LOW); digitalWrite(7,LOW); digitalWrite(6,LOW); void loop() { val = analogRead(A0); percentVal = (val)*iooí(694); Serial.print(percentVal);
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY