/*Vary the brightness of an LED using PWM
Default frequency is 500Hz.
Value 0 : Off or no voltage
alue 255: ON or max voltage
*/
#define LED_PIN 3 // must support PWM, PINS:11,10,9,6...
#define FADE_SPEED 5 // lower is faster
void setup() {
pinMode(LED_PIN, OUTPUT);
}
void loop()
{
for (uint8_t i = 0; i < 255; i+=5) {
analogWrite(LED_PIN, i); //pgm_read_byte( &gamma8[i]));
delay(FADE_SPEED);
}
for (uint8_t i = 255; i > 0; i-=5) {
analogWrite(LED_PIN, i); //pgm_read_byte( &gamma8[i]));
delay(FADE_SPEED);
}
/*
analogWrite(LED_PIN, 0); //pgm_read_byte( &gamma8[i]));
delay(FADE_SPEED);
analogWrite(LED_PIN, 10); //pgm_read_byte( &gamma8[i]));
delay(FADE_SPEED);
analogWrite(LED_PIN, 122); //pgm_read_byte( &gamma8[i]));
delay(FADE_SPEED);
analogWrite(LED_PIN, 255); //pgm_read_byte( &gamma8[i]));
delay(FADE_SPEED);
*/
}