Aditor

Untitled

Jan 12th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.34 KB | None | 0 0
  1. #include <avr/io.h>
  2. #include <util/delay.h>
  3. #define SW (1<<PB0)
  4. #define ONE (1<<PB1)
  5. #define TWO (1<<PB2)
  6.  
  7. #define ONEL (0<<PB1)
  8. #define TWOL (0<<PB2)
  9.  
  10.  
  11. int main() {
  12.     DDRB |= ONE | TWO | ONEL | TWOL;
  13.     DDRB &= ~SW;
  14.     PORTB |= SW;
  15.  
  16.  
  17. while (1) {
  18.  
  19.     if (!(PINB & SW)) {
  20.         PORTB = ONE;
  21.     } else {
  22.         PORTB = ONEL;
  23.     }
  24.  
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment