Hello!
Im created a dark sensor circuit with arduino.
Work correct, but im not need a full arduino, enough a little attiny45.
Can you help me, what wrong in this code?
LDR = attiny45 PB2 (sensor)
led = attiny45 PB0
Thank you
int sensor = 2; //Attiny45 PB2 pin
int led = 0; //Attiny45 PB0 pin
int sensorValue;
void setup(){
pinMode(sensor,INPUT);
pinMode(led, OUTPUT);
}
void loop(){
sensorValue = analogRead(sensor);
if (sensorValue < 500){
digitalWrite(led, HIGH);
}
else{
digitalWrite(led, LOW);
}
}