Led counter on T-bird


SUBMITTED BY: btibi95

DATE: Aug. 23, 2016, 9 p.m.

FORMAT: Objective-C

SIZE: 384 Bytes

HITS: 553

  1. #include <avr/io.h>
  2. #define F_CPU 16000000UL
  3. #include <util/delay.h>
  4. void init(void);
  5. void KiLedre(unsigned char i);
  6. int main (void)
  7. {
  8. init();
  9. KiLedre(0x01);
  10. while(1)
  11. {
  12. }
  13. return 0;
  14. }
  15. void init(void)
  16. {
  17. DDRB=0xf0;
  18. DDRD=0xf0;
  19. }
  20. void KiLedre(unsigned char i)
  21. {
  22. for(i;i<=0xff;i++)
  23. {
  24. PORTD=i;
  25. PORTB=i<<4;
  26. _delay_ms(25); //delay (2s)
  27. }
  28. }

comments powered by Disqus