Skip to content

Commit 29635dc

Browse files
committed
Init
0 parents  commit 29635dc

File tree

6 files changed

+1317
-0
lines changed

6 files changed

+1317
-0
lines changed

button.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#include <avr/io.h>
2+
#include <util/delay.h>
3+
4+
#define BLINK_DELAY_MS 1000
5+
6+
int main(void){
7+
/* set pin 5 of PORTB for output*/
8+
char val=0;
9+
DDRB |= _BV(DDB5);
10+
DDRB &= ~_BV(DDB4);
11+
while(1){
12+
/* set pin 5 high to turn led on */
13+
val= PINB & _BV(PORTB4);
14+
if(!val){
15+
PORTB |= _BV(PORTB5);
16+
}
17+
else{
18+
PORTB &= ~_BV(PORTB5);
19+
}
20+
//PORTB &= ~_BV(PORTB4);
21+
//_delay_ms(BLINK_DELAY_MS);
22+
/* set pin 5 low to turn led off */
23+
//PORTB &= ~_BV(PORTB5);
24+
//PORTB &= ~_BV(PORTB4);
25+
//_delay_ms(BLINK_DELAY_MS);
26+
}
27+
}

0 commit comments

Comments
 (0)