as a matter of fact i thinkn all this software protocols between arduino and the computer are bad education. i searched for serial.flush() and was directed to Arduino Serial protocol design patterns – todbot blog, i think this is the direction should go.
tommorow i have to explain conditions to a seeduino mega and a processingxp
this looks so shinny, waht does it do?
Beside the 2 following improvements:
1. define the variables as unsigned char
unsigned char rx_buffer_head = 0;
unsigned char rx_buffer_tail = 0;
2. use the following code to wrap the values
rx_buffer_tail = rx_buffer_tail + 1;
rx_buffer_tail %= RX_BUFFER_SIZE;
3. Tweak buffer size for your application.
what else can be done to improved the performance of Hardware Serial? I am stuck using 4800 baud
thanx
Mart