|
http://stuff.nekhbet.ro/2009/08/17/arduino-how-to-use-the-serial-port.html Sometimes you really need to use the Serial port (UART or USART) of
Arduino to communicate with your computer (or other devices) for
debugging or readings. The code for doing this is pretty simple, you just need to initialize the serial port and set the baud rate (symbols per second) like this : Serial.begin(9600); and then receive/transmit using the next functions : print, println and write. For official documentation on this click here. As an example .. I wrote 2 small programs that does this : To start the Serial Monitor from Arduino IDE .. just click the last button from the option’s bar and set the baud rate to match your own baud rate used while initializing with Serial.begin(). After pressing the Serial Monitor button a new black area will appear where you can send data to your Arduino board or see the output of it. |
