Video Tutorial

How to program the Serial Monitor to read

Sometimes you may need to read serial data using your Smart Inventor board, say maybe to communicate between two boards, or as in this case send a message from the computer to the Inventor board.

To begin programming the serial monitor begin by typing within the [crayon-666c9c2ea70af446672994-i/]  method.
this line of code sets the amount of bits per second that the Smart Inventor will be sending data at to the computer.

Serial.begin( )

Serial.Begin( BAUD rate);

This function will establish a high transfer BAUD connection between the remote and the board. The higher the BAUD number the faster the board will process information, but may yield a high chance for errors. The lower the BAUD number the slower the board will process information, but may yield a low chance for errors.

Acceptable BAUD rates range from 300 to 250000. Make sure that the BAUD rate is a number that is found within the lower right corner of the Serial Monitor.

Next inside the void loop we will begin to type the command that will read data from the serial line. The way this will be done will be with an if statement.
This statement will be true if the serial line detects any message with the same baud rate. We will be using the computer to send messages to the Smart Inventor board and display it on the serial monitor.

Next inside of the if statements curly braces type
This prints a new line with whatever characters you typed in the serial monitor and clicked send with.

One thing you can do with this is control the Inventor board with your computer as a controller. You could easily use the char read to activate a command, such a drive a motor, or turn on an LED.

Here is the final code.
Upload this code to your board and then open up the serial monitor and follow what the video does. The board should repeat whatever you type into the serial monitor.