Bout rate change real time

Trying to write code that at setup level changes serial baud rates using values stored in array
int boudRate[12]={300, 600, 1200, 2400, 4800, 9600,};
and returns baud rate beck to serial monitor

sereksan:
Trying to write code that at setup level changes serial baud rates using values stored in array
int boudRate[12]={300, 600, 1200, 2400, 4800, 9600,};
and returns baud rate beck to serial monitor

Like this... ?

int baudRate[12]={300, 600, 1200, 2400, 4800, 9600, 19200}; 

int baudRateWeWant= 5;   // index 5 will be 9600 baud

void setup()
{
    Serial.begin( baudrate[ baudRateWeWant ] );   // set the baud rate we want

... not sure why you want to do this tho.

Yours,
TonyWilk

YOu just make a for loop and send a test pattern to the other side
if the other side gives the expected response you nailed the baudrate (with AUD)

  1. Be sure to give the other side some time to response

  2. I never had 300 baud work as it should