示例#1
0
void main()
{
	// Enable UART with baud rate 9600
	uart_init(9600);

	// Functions from `stream.h` will work with any stream
	// "uart" is a pointer to the UART stream

	put_str(uart, "UART is 1337");
	put_nl(uart);
	put_str_P(uart, PSTR("String from program memory!!!"));
	put_nl(uart);

	put_u16f(uart, 31416, 4);

	put_i32(uart, 123456789L);

	put_nl(uart);

	put_x16(uart, 0xAC01);
	put_nl(uart);
	put_x64(uart, 0xABAD1DEADEADBEEF);

	while(1);
}
示例#2
0
文件: main.c 项目: MightyPork/avr-lib
// Our custom key handler function
void key_handler(uint8_t code, bool special)
{
	put_str_P(uart, special ? PSTR("Special: ") : PSTR("Char: "));
	put_c(uart, code); // the actual character
	put_c(uart, ' '); // space
	put_u8(uart, code); // as number
	put_nl(uart); // crlf
}