Arduino

UART

작성자 임베디드코리아 작성일23-11-29 16:49 조회388회 댓글0건
#include <SoftwareSerial.h>
 
SoftwareSerial kilsungSerial(3, 8); // RX, TX
 
void setup() 
{
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  Serial.println("GLORY, KILSUNG!");
 
  // set the data rate for the SoftwareSerial port
  kilsungSerial.begin(9600);

}
 
void loop() // run over and over
{
  // Receive from bluetooth and send it to PC
  if (kilsungSerial.available())
    Serial.write(kilsungSerial.read());
 
  if (Serial.available())
    kilsungSerial.write(Serial.read());
}