LEDStrips.h
void adjustBrightness()
    {
        Serial.println("LEDStrips.adjustBrightness");
        // store the current LED brightness so we can minimize minor differences
        static int LEDbrightness = 0;

        // check the photocell and map 0-1023 to 0-255 since that is the range for setBrightness
        int photocellReading = analogRead(PHOTOCELL_PIN);
        int newBrightness = map(photocellReading, 0, 1023, 0, 255);

        // adjust our brightness if it has changed significantly
        if ((newBrightness > LEDbrightness + 5) || (newBrightness < LEDbrightness - 5))
        {
#ifdef __DEBUG__
            Serial.print("Analog photocell reading = ");
            Serial.println(photocellReading); // the raw analog reading
            Serial.print("new brightness = ");
            Serial.println(newBrightness);
#endif
            LEDbrightness = newBrightness;
            for (int x = 0; x < LED_STRIPS; x++)
            {
                strip[x].setBrightness(LEDbrightness);
            }
        }
    }
// automatically adjust the brightness of the LED strips to match the ambient lighting
automatically adjust the brightness of the LED strips to match the ambient lighting
automatically adjust the brightness of the LED strips to match the ambient lighting
void adjustBrightness()
    {
        Serial.println("LEDStrips.adjustBrightness");
        static int LEDbrightness = 0;
        int photocellReading = analogRead(PHOTOCELL_PIN);
        int newBrightness = map(photocellReading, 0, 1023, 0, 255);
        if ((newBrightness > LEDbrightness + 5) || (newBrightness < LEDbrightness - 5))
        {
#ifdef __DEBUG__
            Serial.print("Analog photocell reading = ");
            Serial.println(photocellReading); 
            Serial.print("new brightness = ");
            Serial.println(newBrightness);
#endif
            LEDbrightness = newBrightness;
            for (int x = 0; x < LED_STRIPS; x++)
            {
                strip[x].setBrightness(LEDbrightness);
            }
        }
    }
void adjustBrightness ( ) { Serial . println ( " " ) ; static int LEDbrightness = 0 ; int photocellReading = analogRead ( PHOTOCELL_PIN ) ; int newBrightness = map ( photocellReading , 0 , 1023 , 0 , 255 ) ; if ( ( newBrightness > LEDbrightness + 5 ) || ( newBrightness < LEDbrightness - 5 ) ) { #ifdef __DEBUG__ Serial . print ( " " ) ; Serial . println ( photocellReading ) ; Serial . print ( " " ) ; Serial . println ( newBrightness ) ; #endif LEDbrightness = newBrightness ; for ( int x = 0 ; x < LED_STRIPS ; x ++ ) { strip [ x ] . setBrightness ( LEDbrightness ) ; } } }
automatically adjust the brightness of the LED strips to match the ambient lighting
automatically adjust the brightness of the LED strips to match the ambient lighting
// store the current LED brightness so we can minimize minor differences // check the photocell and map 0-1023 to 0-255 since that is the range for setBrightness // adjust our brightness if it has changed significantly // the raw analog reading