Home > Projects > Interfacing(USB – RS232 – I2c -ISP) Projects > Arduino Serial Communication Code

Arduino Serial Communication Code

Summary of Arduino Serial Communication Code


Arduino can send output over USB serial to a computer, allowing you to view status, text, sensor readings, and other values via the Arduino IDE Serial Monitor. Connect an Arduino to your PC with a USB A-to-B cable, upload code that initializes Serial at 9600 baud in setup(), and use Serial.println() in loop() to send text (example sends two lines then delays 3 seconds).

Parts used in the Arduino Serial Communication Project:

  • 1x USB cable A-B
  • 1x Arduino

Arduino can send output through serial communication to your computer over USB. The output can be anything such as status, text, sensor reading, value, number etc. You can view the status output by clicking Serial Monitor button at Arduino Environment software.

Instruction;
1) Connect your arduino to your computer using USB cable A plug to B plug.

Upload this code to your arduino

/*
  Serial Communication
  Arduino can send output through serial communication to your computer over USB.

  Coded by: arduinoprojects101.com
*/

void setup() {
  Serial.begin(9600);
}

void loop() {
  Serial.println("output text send through serial print");
  Serial.println("delay 3 seconds");
  delay(3000);
}

Serial.begin(9600);
Instruct arduino to start serial communication with 9600 bits of data per second.

Major Components in Project
Parts List;
1) 1x USB cable A-B
2) 1x Arduino

For more detail: Arduino Serial Communication Code

Quick Solutions to Questions related to Arduino Serial Communication Project:

  • How do I connect the Arduino to my computer?
    Connect the Arduino to your computer using a USB cable A plug to B plug.
  • How do I start serial communication in Arduino code?
    Use Serial.begin(9600) in setup to start serial communication at 9600 bits per second.
  • Can Arduino send text to the computer?
    Yes, Arduino can send text using Serial.println to transmit output over USB serial.
  • What baud rate is used in the example code?
    The example code uses 9600 baud as set by Serial.begin(9600).
  • How can I view the serial output on my computer?
    Open the Serial Monitor in the Arduino IDE to view the output sent over serial.
  • What does the example loop do?
    The loop sends two lines with Serial.println and then delays for 3 seconds using delay(3000).
  • Does the code require any additional hardware?
    No, the project requires only an Arduino and a USB A-B cable as listed.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter
Scroll to Top