Home. » Project 2: Output control with serial commands on an ARDUINO UNO.

Switching with commands on the serial port.

Parts and things you need.

1. Arduino UNO.

2. Breadboard.

3. LEDs (10 x), 1K resistors (10x) and some wire cables (male to male).

4. Already installed Arduino IDE on the PC/laptop and an USB cable to the Arduino UNO.

 

Schematic.

 

Arduino program.

 

program description.

 

The program above is uploaded to the Arduino UNO and then you can test it with the "serial monitor" of the Arduino IDE. Baudrate must be set to "115200 baud" and configured with "no line ending". In the send_line_textbox you can use the commands like SW00_ON, sw00_on, SW03_OFF, sw04_off or other combinations with different SWITCH NUMBERS to switch the LEDs ON or OFF. When the program starts, it shows us which pin numbers are configured as OUTPUT on the Arduino UNO. It doesn't matter if the commands are being sent in lowercase or uppercase. After testing through the USB connection with the PC/laptop, the RX and TX pins can be used for external serial port connections to other circuits. The USB connection must be disconnected and using an external power supply for the Arduino UNO or the serial communication port on the PC/laptop must be closed.

Command string syntax is:       SW|number|_|action|  

[ |number| = 00 / 01 / ..... / 09 ]  [ |action| = ON / OFF ]

 

See screenshots below of the "serial monitor" of the Arduino IDE.