25 lines
303 B
C
25 lines
303 B
C
|
#include "led.h"
|
||
|
#include "uart.h"
|
||
|
|
||
|
int main() {
|
||
|
int c;
|
||
|
int led = 0;
|
||
|
|
||
|
while (1) {
|
||
|
led_write(1 << led);
|
||
|
c = uart_read();
|
||
|
|
||
|
if (c == 'a') {
|
||
|
led++;
|
||
|
} else if (c == 'd') {
|
||
|
led--;
|
||
|
}
|
||
|
|
||
|
if (led == 8) {
|
||
|
led = 0;
|
||
|
} else if (led < 0) {
|
||
|
led = 7;
|
||
|
}
|
||
|
}
|
||
|
}
|