I’m using an Arduino Nano and trying to change the baud rate to talk with a wifi chip (HF-LP100). I’ve successfully changed from 11500 to 9600 but I am unable to change from 9600 to 115200. How I’m trying to do it
Serial.begin(9600);
delay(1000);
if (digitalRead(PD7) == 1) { //this is wifi status
Serial.end();
delay(500);
Serial.begin(115200);
delay(1000);
//code to change wifi chip is here already know this works
Serial.end();
delay(500);
Serial.begin(9600);
delay(1000);
}
I have successful made the wifi chip change baud rates with the initial nano baud rate set to 115200 and then successfully sent commands to the chip after I’ve changed it to 9600, so that means I’ve changed the Nano baud rate to 9600 as well.
I’ve also tried this with the ‘Serial.flush()’ command before 'Serial.end(); but that didn’t change anything. I’ve looked through several posts on here but haven’t found a solution from them. Thanks for any help!
Edit: So I’m not quite sure why but it seems to be working correctly now. I put Serial.flush(); back in and delay(2); but it didn’t work with these earlier…so code is like this
Serial.flush();
delay(2);
Serial.end();
delay(500);
//Start the serial port and wait for it to initialize
Serial.begin(115200);
delay(3000);
//code to change wifi chip is here already know this works
Serial.flush();
delay(2);
Serial.end();
delay(500);
Serial.begin(9600);
delay(3000);
}