int main(void) { uint8_t brightness = 0; int8_t direction = 1; // -------- Inits --------- // // Init all LEDs LED_DDR = 0xff; // ------ Event loop ------ // while (1) { // Brighten and dim if (brightness == 0) { direction = 1; } if (brightness == 255) { direction = -1; } brightness += direction; pwmAllPins(brightness); } /* End event loop */ return 0; /* This line is never reached */ }
int main(void) { clock_prescale_set(clock_div_16); uint8_t brightness = 0; int8_t direction = 1; LED_DDR = 0xff; while (1) { // Bright and dim if (brightness == 0) { direction = 1; } if (brightness == 255) { direction = -1; } brightness += direction; pwmAllPins(brightness); } return (0); }