1
0
mirror of synced 2024-11-13 04:48:53 +01:00
avr_demo/blog/simple_usart/main.c

37 lines
707 B
C

/*
* Demonstration on how to redirect stdio to UART.
*
* http://appelsiini.net/2011/simple-usart-with-avr-libc
*
* To compile and upload run: make clean; make; make program;
* Connect to serial with: screen /dev/tty.usbserial-*
*
* Copyright 2011 Mika Tuupola
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/mit-license.php
*
*/
#include <stdio.h>
#include "main.h"
#include "uart.h"
int main(void) {
uart_init();
stdout = &uart_output;
stdin = &uart_input;
char input;
while(1) {
puts("Hello world!");
input = getchar();
printf("You wrote %c\n", input);
}
return 0;
}