#include "comms.h" #include #define USART_BAUDRATE 9600 //! USART baudrate, change this to set it. #define UBRR_VALUE (((F_CPU/(USART_BAUDRATE*16UL)))-1) char* song_names[3] = { "baila.wav", "giorno.wav", "nevergonnagiveyo" }; int main() { // initialize USART UBRR0L = UBRR_VALUE & 255; UBRR0H = UBRR_VALUE >> 8; UCSR0B = (1 << TXEN0) | (1 << RXEN0); // fire-up USART UCSR0C = (1 << UCSZ01) | (1 << UCSZ00); // fire-up USART while(1) { // Send a clear command comms_clear(); _delay_ms(1000); // send a number of songs comms_send_num(3); // Wait for request, get song num, then send song info 3 times for (uint8_t i = 0; i < 3; i++) { while(! (UCSR0A & (1 << TXC0))); uint8_t in_song = UDR0; while(! (UCSR0A & (1 << TXC0))); in_song = UDR0; comms_reply_name(song_names[in_song]); } // wait a while _delay_ms(20000); } }