example_blonk.c (535B)
1 #define BAUD 9600 2 3 /* AAIO features to use */ 4 #define AAIO_FEATURE_LED 5 #define AAIO_FEATURE_USBUART 6 7 /* include the AAIO header */ 8 #include "aaio.h" 9 10 int main (void) { 11 aaio_led_init(); 12 aaio_uart_init(); 13 aaio_uart_redirect_stdout(); 14 aaio_uart_redirect_stdin(); 15 char buf[100]; 16 while(1) { 17 printf("command> "); 18 aaio_uart_gets(buf, sizeof(buf), 1); 19 printf("You entered: %s\r\n", buf); 20 if(buf[0] == '0') aaio_led_set(0); 21 else if(buf[0] == '1') aaio_led_set(1); 22 else aaio_led_toggle(); 23 } 24 return 0; 25 } 26 27