#define F_CPU 16000000UL #define __AVR_ATmega328P__ #include #include #include #include "../include/uart.h" #include "../include/adc.h" #include "../include/rand.h" #define BAUD 9600 #define MYUBRR F_CPU/16/BAUD-1 int main (void) { uart_init(); adc_init(); sei(); char buf[10]; uint16_t sensor[2] = { 0, 1 }; while (1) { // lets say we read some value from a sensor sensor[0] = adc_read(0); sensor[1] = adc_read(1); // we want to print this, so we store the ascii repr in our buffer uart_printi("sensor 0: ", sensor[0]); uart_printi("sensor 1: ", sensor[1]); _delay_ms(1000); } } ISR (USART_RX_vect) { // echo the message char c = UDR0; uart_printc(c); }