Question: write a well comment on the ATMEGA 328P -UP microcontroller of the sun tracking solar panel below: #include Servo myservo; int ldr1 = 4; int
write a well comment on the ATMEGA 328P -UP microcontroller of the sun tracking solar panel below:
#includeServo myservo; int ldr1 = 4; int ldr2 = 5; int val1; int val2; int pos=90; void setup() { myservo.attach(11); Serial.begin(9600); myservo.write(pos); } void loop() { val1 = analogRead(ldr1); val2 = analogRead(ldr2); val1 = map(val1, 0, 1023, 0, 180); val2 = map(val2, 0, 1023, 0, 180); if(val1 > (val2+50)) { if(pos<180) pos=pos+1; myservo.write(pos); Serial.println("backward"); delay(10); } else if(val2 > (val1+50)) { if(pos>0) pos=pos-1; myservo.write(pos); Serial.println("forward"); delay(10); } }
you can use this website to help
https://www.electronicshub.org/sun-tracking-solar-panel/
thank you
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
