Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <avr/io.h>
- #include <util/delay.h>
- #define SW (1<<PB0)
- #define ONE (1<<PB1)
- #define TWO (1<<PB2)
- #define ONEL (0<<PB1)
- #define TWOL (0<<PB2)
- int main() {
- DDRB |= ONE | TWO | ONEL | TWOL;
- DDRB &= ~SW;
- PORTB |= SW;
- while (1) {
- if (!(PINB & SW)) {
- PORTB = ONE;
- } else {
- PORTB = ONEL;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment