Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The purpose of this project is to use two light sensors (foto resistor) to measu

ID: 2266463 • Letter: T

Question

The purpose of this project is to use two light sensors (foto resistor) to measure light intensity in two opposite positions (0 & 180°) and indicate the position with a servomotor. The materials that will be used are: as light photo sensor two foto resistors, also, the Arduino micro-controller, two LEDs, a servo motor (stepper or DC motors) and a buzzer. The light sensor (foto resistor) is a sensor that behaves like a short circuit in the presence of light, and a high resistance when it is dark. Each LED will indicate when a photo resistor is illuminated (positioned on opposite sides of the servomotor), while the servomotor moves to the illuminated side In addition, a buzzer will sound a different tone for each position. When the intensity of the two photo-resistors is the same, the servo must be placed in a central position (90°), the LEDs and the buzzer must be turned off. Must submit a written report showing all processes made and include photos, video, codes, calculations, so all needed for the project. Additional, must give an oral presentation (not exceeding 10 minutes per group) explaining and showing everything you did. In the presentation you must make a demonstration of its circuit

Explanation / Answer

#include <Servo>
Servo servo_test;
int foto1 = A0;
int foto2 = A1;

int led1 = 5;
int led2 = 6;
int buzzer = 9;
int angle = 0;
int a,b,c,d;
int LEDbrightness1, LEDbrightness2;

void setup() {
// put your setup code here, to run once:
pinMode(A0,INPUT);
pinMode(A1,INPUT);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
servo_test.attach(8);
pinMode(9,OUTPUT);
}

void loop() {
// put your main code here, to run repeatedly:
a = analogRead(A0);
b = analogRead(A1);
//tone(9,1000,500); // pin,freq(Hz),duration(millisec)
for(angle = 0; angle < 180; angle += 1)    // command to move from 0 degrees to 180 degrees
{                                
    servo_test.write(angle);                 //command to rotate the servo to the specified angle
    delay(15);                     
}

delay(1000);

for(angle = 180; angle>=1; angle-=5)     // command to move from 180 degrees to 0 degrees
{                              
    servo_test.write(angle);              //command to rotate the servo to the specified angle
    delay(5);                     
}

delay(1000);

while(a != 0 || b != 0)
{
    a = 1023 - a;
    c = 1000 + a*100;
    tone(9,c,500);
    LEDbrightness1 = map(a, 0,1023, 0, 255);
    analogWrite(5, LEDbrightness1);
  
    b = 1023 - b;
    d = 1000 + d*100;
    tone(9,d,500);
    LEDbrightness2 = map(b, 0,1023, 0, 255);
    analogWrite(6, LEDbrightness2);
    }

if (a == b)
{
    servo_test.write(90);
    tone(9, 0, 100);
    analogWrite(5, 0);
    analogWrite(6, 0);
    }
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote