We sent the character to control the LEDs separately, by clicking send after each character. However, it will work just as well, if you send all the character commands in a single line. Try entering the following into the Serial Monitor and clicking 'Send':
x0246
Now, lets see just how fast our Arduino can communicate. Change the baud rate in the sketch from 9600 to 115200 and upload it to the board again. Then after opening the Serial Monitor select 115200 from the drop-down list.
x0246
Now, lets see just how fast our Arduino can communicate. Change the baud rate in the sketch from 9600 to 115200 and upload it to the board again. Then after opening the Serial Monitor select 115200 from the drop-down list.
You should find that that everything still works. High speed communication not often necessary, so the baud rate of 9600 is often used, as many serial peripherals such as GPS modules will have this as a default baud rate, so it is something of a standard.
Also, try mismatching the baud rate - use Serial.begin(9600) and select 57600 in the dropdown menu, for example. See what it looks like? All garbled? That's a mismatch. If you're ever getting strange data in the Serial monitor, triple check your baud rates and make sure they match!
The Serial Monitor is also a great way of debugging a sketch that is misbehaving. Sometimes, when a sketch is not behaving how you think it should behave, placing Serial.println() statements in key places will help you see what is going on.
Also, try mismatching the baud rate - use Serial.begin(9600) and select 57600 in the dropdown menu, for example. See what it looks like? All garbled? That's a mismatch. If you're ever getting strange data in the Serial monitor, triple check your baud rates and make sure they match!
The Serial Monitor is also a great way of debugging a sketch that is misbehaving. Sometimes, when a sketch is not behaving how you think it should behave, placing Serial.println() statements in key places will help you see what is going on.
About the Author
Simon Monk is author of a number of books relating to Open Source Hardware. The following books written by Simon are available from Adafruit: Programming Arduino, 30 Arduino Projects for the Evil Genius and Programming the Raspberry Pi.
Simon Monk is author of a number of books relating to Open Source Hardware. The following books written by Simon are available from Adafruit: Programming Arduino, 30 Arduino Projects for the Evil Genius and Programming the Raspberry Pi.
Page last edited October 09, 2012
Text editor powered by tinymce.