Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int odczytanaWartosc = 0; //Variable to store ADC read
- int prog = 0; //Light switching threshold - set by the potentiometer
- void setup() {
- pinMode(8, OUTPUT); //Configuration of outputs for the LED
- }
- void loop() {
- odczytanaWartosc = analogRead(A5);//Reading values from the ADC
- prog = analogRead(A4);//Reading values from the ADC
- if (odczytanaWartosc < prog) { //Is it darker than the set threshold?
- digitalWrite(8, HIGH);//Turn on the diode
- } else {
- digitalWrite(8, LOW);/Turn off the diode
- }
- delay(50);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement