Author Options:

Fitlight trainer using arduino Answered

I want to make a fitlight trainer with arduino. I want to make it with leds and LDR ligtht sensors. A random light pops up and when you hover over the sensor it sets it to LOW and then another random light pops up and over and over.

Can anyone help me with this idea?

I have the code for one light:

int LDR = 0;     //analog pin to which LDR is connected, here we set it to 0 so it means A0
int LDRValue = 0;      //that’s a variable to store LDR values
int light_sensitivity = 20;    //This is the approx value of light surrounding your LDR

void setup()
    pinMode(13, OUTPUT);   

void loop()
    LDRValue = analogRead(LDR);      //reads the ldr’s value through LDR
    Serial.println(LDRValue);       //prints the LDR values to serial monitor
    delay(50);        //This is the speed by which LDR sends value to arduino

    if (LDRValue > light_sensitivity)
        digitalWrite(13, HIGH);
        digitalWrite(13, LOW);


The forums are retiring in 2021 and are now closed for new topics and comments.

3 years ago

Have you think to comunication betwen lights ?