With serial communication you can communicate with other software as well. You could for example use Arduino to read from a button and send the button state data to a processing sketch that changes the color of the screen when the button is pushed.
The serial port uses the digital pins 0 and 1:
- Pin 0: RX or receiver. Receives data to the Arduino.
- Pin 1: TX or transmitter. Sends data from the Arduino.
Therefore, do not use the function digitalRead()
and digitalWrite()
on these pins if you are using serial communication.
It is important that the sender and receiver are communicating in the same speed. Otherwise, it will be like two people trying to communicate, one talking in Chinese and the other one in Spanish. The speed is called baud rate and measures bits per second. The most common speed when working with Arduino and Processing is 9600 bits per second.