03-02-2023, 05:23 AM
Code:
/*********************************
**********************************/
#define A4S_RS485_RX 33
#define A4S_RS485_TX 32
void setup() {
Serial.begin(115200);
pinMode(0,INPUT);
Serial2.begin(115200,SERIAL_8N1,A4S_RS485_RX,A4S_RS485_TX);//A4S
Serial2.println("A4S 485 TEST");
}
void loop() {
if(digitalRead(0)==LOW)
{
delay(20);
if(digitalRead(0)==LOW)
{
Serial2.println("Download key ok");
}
}
while(Serial2.available()>0)
{
Serial2.print((char)Serial2.read());//print rs485 receive
}
delay(200);
}