krot

AVR 1

Jan 10th, 2016
69
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #define F_CPU 8000000
  2. #include <avr/io.h>
  3. #include <util/delay.h>
  4. #include <stdlib.h>
  5.  
  6. void init(void){
  7. DDRB=0xff;
  8. PORTB=0x00;
  9. }
  10.  double times;
  11. int main(void)
  12. {
  13. init();
  14. while(1){
  15.      times=1000+rand()%50;
  16.         PORTB=0xff;
  17.        _delay_loop_1(times);
  18.         PORTB=0x00;
  19.         times=1000+rand()%50;
  20.         _delay_loop_1(times);
  21. }}
RAW Paste Data