Smart Home Automation Forum
[Arduino source code for KC868-AM]-01 RS485 - Printable Version

+- Smart Home Automation Forum (https://www.kincony.com/forum)
+-- Forum: Technical Support (https://www.kincony.com/forum/forumdisplay.php?fid=20)
+--- Forum: KC868-AM (https://www.kincony.com/forum/forumdisplay.php?fid=45)
+--- Thread: [Arduino source code for KC868-AM]-01 RS485 (/showthread.php?tid=2711)



[Arduino source code for KC868-AM]-01 RS485 - KinCony Support - 03-22-2023

Code:
//AM
#define AM_RS485RX  35
#define AM_RS485TX  32
void setup() {
  Serial.begin(115200);
  Serial2.begin(115200,SERIAL_8N1,AM_RS485RX,AM_RS485TX);

   Serial2.println("AM RS485 SEND is OK!!");
   Serial2.println("******************");
 
}

void loop() {
  /*print the received data of RS485 port*/
  while(Serial2.available()>0)
   {
    Serial2.print((char)Serial2.read());//Read rs485 receive data  and print it
   }
  delay(200);
}