28 lines
535 B
C
28 lines
535 B
C
#define BAUD 9600
|
|||
|
|
|
||
|
|
/* AAIO features to use */
|
||
|
|
#define AAIO_FEATURE_LED
|
||
|
|
#define AAIO_FEATURE_USBUART
|
||
|
|
|
||
|
|
/* include the AAIO header */
|
||
|
|
#include "aaio.h"
|
||
|
|
|
||
|
|
int main (void) {
|
||
|
|
aaio_led_init();
|
||
|
|
aaio_uart_init();
|
||
|
|
aaio_uart_redirect_stdout();
|
||
|
|
aaio_uart_redirect_stdin();
|
||
|
|
char buf[100];
|
||
|
|
while(1) {
|
||
|
|
printf("command> ");
|
||
|
|
aaio_uart_gets(buf, sizeof(buf), 1);
|
||
|
|
printf("You entered: %s\r\n", buf);
|
||
|
|
if(buf[0] == '0') aaio_led_set(0);
|
||
|
|
else if(buf[0] == '1') aaio_led_set(1);
|
||
|
|
else aaio_led_toggle();
|
||
|
|
}
|
||
|
|
return 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
|