This repository
This repository
All repositories

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS, or Subversion.

Download ZIP
branch: master
Switch branches/tags
Nothing to show
Nothing to show
file 37 lines (29 sloc) 0.707 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
/*
* 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;
}
Something went wrong with that request. Please try again.