Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- codando com gcc-avr
- pisca pisca simples no pino 5
- by Cooler_
- c00f3r[at]gmail[dot]com
- tudo isso para fazer led piscar :-/
- */
- #include <avr/io.h>
- #include <util/delay.h>
- #define LEDPIN 5
- void
- pausa(unsigned int ms)
- {
- unsigned int x,y;
- for(y=0; y<1000; y++)
- for(x=0; x<ms; x++);
- }
- int
- main (void)
- {
- // para usar pino 5
- DDRD|=1<<LEDPIN;
- do{
- // OFF
- PORTD&=~(1<<LEDPIN);
- pausa(500);
- // ON
- PORTD|=1<<LEDPIN;
- pausa(500);
- }while(1);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment