Hello,
Is it possible to adjust the baudrate of the serial port without a reset?
Thanks,
-ren
Hello,
Is it possible to adjust the baudrate of the serial port without a reset?
Thanks,
-ren
Yes, something like this
void setup()
{
Serial.begin(9600);
Serial.print("press A for high speed mode, any other key to keep 9600");
while(Serial.available == 0);
if (Serial.Read() == 'A') Serial.begin(115200);
}
void loop()
{
Serial.println("Hello world");
delay(1000);
}
Yes, something like this...
How does this get around the auto reset feature?
Don
Everything passes through setup (), but you can place a call to Serial.begin() anywhere. I think it's commonplace having Serial.begin( ); in the setup(), but it could be put in a baudrate function all its own.
biggest problem is that you have to synchronize the sender / receiver when switching. But you can make a sort of "encrypted" communication by switching the baudrate per byte.
NOte that the hardware can do almost any baudrate where software serial has the standard values .
robtillaart,
Thanks, I suspected that could call begin twice, but I wasn't sure...thanks for clearing it up.
-ren