47 lines
931 B
C
47 lines
931 B
C
|
/*
|
||
|
* Test how to use uart stuff as an outside library. Redirects stdout
|
||
|
* to uart.
|
||
|
*
|
||
|
* Led at Arduino digital 13 (PORTB5). Cause we all love blinken leds!
|
||
|
*
|
||
|
* To compile and upload run: make clean; make; make program;
|
||
|
* Connect to serial with: screen /dev/tty.usbserial-* 9600
|
||
|
*
|
||
|
* Copyright 2011 Mika Tuupola
|
||
|
*
|
||
|
* Licensed under the MIT license:
|
||
|
* http://www.opensource.org/licenses/mit-license.php
|
||
|
*
|
||
|
*/
|
||
|
|
||
|
#ifndef F_CPU
|
||
|
#define F_CPU 16000000UL
|
||
|
#endif
|
||
|
|
||
|
//#include <stdlib.h>
|
||
|
#include <avr/io.h>
|
||
|
#include <stdio.h>
|
||
|
#include <util/delay.h>
|
||
|
|
||
|
#include "main.h"
|
||
|
#include "uart.h"
|
||
|
|
||
|
int main(void) {
|
||
|
|
||
|
uart_init();
|
||
|
stdout = &uart_output;
|
||
|
stdin = &uart_input;
|
||
|
|
||
|
while (1) {
|
||
|
/* Blink led by toggling state of PORTB5 (Arduino digital 13). */
|
||
|
PORTB ^= _BV(PORTB5);
|
||
|
|
||
|
puts("Hello async world!");
|
||
|
|
||
|
_delay_ms(500);
|
||
|
}
|
||
|
|
||
|
return 0;
|
||
|
|
||
|
}
|