uart: add ledctrl app

This commit is contained in:
Paul Mathieu
2021-02-22 20:37:18 -08:00
parent b8ee42bfc2
commit 2f210dd561
5 changed files with 55 additions and 0 deletions

24
uart/ledctrl.c Normal file
View File

@@ -0,0 +1,24 @@
#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;
}
}
}