Go Down

Topic: Serial.begin(int speed) is not an int (Read 457 times) previous topic - next topic


Serial.begin(int speed) http://arduino.cc/en/Serial/Begin says
use one of these rates: 300, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, or 115200

Data type int http://arduino.cc/en/Reference/Int says
This yields a range of -32,768 to 32,767

So the speeds of 38400, 57600, and 115200 don't fit.  The first two will if it's an unsigned int, but even then the 115200 won't.


But in wiring.serial library baud is a long variable. A long is big enough to hold any of the possible baud rate values.

void beginSerial(long baud)



I figured as much.  If it didn't work, someone would have objected long before now.  I just mention it so someone can update the web page.

Go Up