Most of the communication you’ll be doing with the Arduino (for now) will be done via the Serial port (The USB cord). ------This is quite trivial to set up on the Arduino. Merely add the following line to your setup() method: ------Serial.begin(9600); ------9600 is the baud rate, something we will not get into here (it essentially means the number of signal changes madeper second, and merely ensures that the PC and the Arduino are on the same page in regards to this). Whenever youwould like to write something to the serial port, simply use the Serial.print or Serial.println function, as so: ------Serial.print(“Hello world!”);
Reading from the Serial Port
Note that you will have to read in a single character at a time via the serial port, which is rather unfortunate.
If you take a peek at the sample code for our calculator application, specifically the waitForNum(); method, you will see an example of how to read in all characters entered, albeit in this case for a number.