#include <Servo.h>
Servo yopogi;
Servo impogi;
int lednared = 6;
int servosooooo = 11;
int lednagreen = 7;
int servosososo = 9;
int burezz = 5;
int rld = A0;
int ldr = A1;
void setup() {
// put your setup code here, to run once:
yopogi.attach (servosooooo);
impogi.attach (servosososo);
Serial.begin (9600);
pinMode (rld, INPUT);
pinMode (ldr, INPUT);
pinMode (lednared, OUTPUT);
pinMode (lednagreen, OUTPUT);
pinMode (servosooooo, OUTPUT);
pinMode (servosososo, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
int ldrstatusnyo = analogRead(rld);
int walanasila = analogRead(ldr);
if (ldrstatusnyo>250) {
yopogi.write (180);
impogi.write (180);
digitalWrite (lednared, LOW);
digitalWrite (lednagreen, HIGH);
tone (burezz, 1000);
Serial.print (ldrstatusnyo);
Serial.println ("brightening: ");
}
else if (walanasila>250) {
yopogi.write (0);
impogi.write (0);
digitalWrite (lednared, HIGH);
digitalWrite (lednagreen, LOW);
tone (burezz, 1000);
Serial.print (walanasila);
Serial.println ("brightening: ");
}
}