#define F_CPU 16000000UL
#include <util/delay.h>
#include<stdlib.h>
void uart_init(void){
UBRR0H = 0;
UBRR0L = 103;
UCSR0B = (1<<TXEN0) | (1<<RXEN0);
UCSR0C = (1<<UCSZ01) | (1<<UCSZ00);
}
void uart_putc(char c){
while (!(UCSR0A & (1<<UDRE0)));
UDR0=c;
}
char uart_getc(void){
while (!(UCSR0A & (1<<RXC0)));
return UDR0;
}
void uart_print(const char *s){
while (*s) uart_putc(*s++);
}
void uart_print_int(int n){
char buf[7];
itoa(n,buf,10);
uart_print(buf);
}
void setup() {
uart_init();
uart_print("Ready\r\n");
}
void loop() {
char c = uart_getc();
uart_putc(c);
}