How To Send Serial Data From Arduino To Laptop or PC
Serial Communication plays important role within the communication system. All micro-controller should have serial communication port.Serial communication provides a text-user-interface(TUI). One will use serial port of microcontroller to send data serially to laptop/PC or receive data serially from laptop/PC.Here we use arduino board to communicate with the laptop. Arduino board have a minimum of one serial port to communicate known as UART and USART. It communicates with digital pin 0 and 1 of arduino refer to as RX and TX pin as well as with the computer via USB.
Virtual Terminal |
Arduino has a built-in function for serial port thus there is no need to go into register detail. In Arduino IDE, one can easily call the serial function for the serial port and job is finished. A simple connection for serial communication is shown below
Connection For Serial Communication |
For serial communication with arduino, we have to use three function known as Serial.begin(), Serial.print(),Serial.println(). Their function is as follows
1: Serial.begin()
To initialize the serial port for the communication we use this function.In this function baud rate is used to initialize the serial port. Here we have used 9600 baud rate for the communication.
2: Serial.print()
This function helps to send serial data to the device connected to the serial port of arduino board. Using this function we are able to send both ASCII and string to the device.
3: Serial.println()
This function is used to print the send data into a new line and all the function is same as the previous function.
Circuit diagram:
Circuit Diagram |
Download the hex file from below.this image is just for showing. we connected a led to pin no 5 of arduino board therefore whenever data is sent to laptop/PC led can blink.
Comments
Post a Comment