Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <avr/io.h>
- void led(int _led, int _r, int _g, int _b);
- void send(void);
- int leds[255][3];
- int main(void)
- {
- DDRB |= (1 << PORTB0);
- while(1)
- {
- for(int l = 0; l < 255; l++)
- {
- led(l, 255, 0, 0);
- }
- send();
- }
- }
- void led(int _led, int _r, int _g, int _b)
- {
- leds[_led][0] = _g;
- leds[_led][1] = _r;
- leds[_led][2] = _b;
- }
- void send()
- {
- for(int l = 0; l < 255; l++)
- {
- for(int c = 0; c < 3; c++)
- {
- for(int m = 0; m < 8; m++)
- {
- if(leds[l][c] & (1 << m))
- {
- PORTB |= (1 << PORTB0);
- }
- else
- {
- PORTB &= ~(1 << PORTB0);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement