Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define F_CPU 7372800UL // UL -> unsigned long - frekvencija CPU-a
- #include <avr/io.h>
- #include <util/delay.h>
- void delaying(uint16_t timeout){
- uint16_t i;
- for (i=0;i<timeout;i++){
- _delay_ms(1);
- }
- }
- void blink(void){
- PORTA ^= _BV(5); // _BV -> bitvise
- }
- int main(void)
- {
- DDRA = _BV(5);
- PORTA = _BV(5);
- uint16_t timeout = 100;
- while (1) {
- blink();
- timeout = timeout + 100;
- delaying(timeout);
- //_delay_ms(100); // 100ms delay -> half cycle , 200ms -> full cycle
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement