diff --git a/include/uart.c b/include/uart.c index 17769e4..8b6cecf 100644 --- a/include/uart.c +++ b/include/uart.c @@ -27,7 +27,6 @@ void uart_printc(char c) { void uart_prints(char* s) { while(*s) uart_printc(*s++); - uart_printc('\n'); } char uart_getc() { while (UCSR0A & (1 << RXC0)); diff --git a/print/main.c b/print/main.c index 50594ed..5b65a87 100644 --- a/print/main.c +++ b/print/main.c @@ -4,6 +4,8 @@ #include #include #include "../include/uart.h" +#include +#include #define BAUD 9600 #define MYUBRR F_CPU/16/BAUD-1 @@ -13,9 +15,19 @@ int main (void) { uart_init(); sei(); + + char buf[10]; + int sensor; + while (1) { - uart_prints("foofofofo"); + // lets say we read some value from a sensor + sensor = 65; + // we want to print this, so we store the ascii repr in our buffer + itoa(sensor, buf, 10); // base 10 + uart_prints("sensor status: "); + uart_prints(buf); + uart_prints("\n"); _delay_ms(1000); } }