According to the sample code of the RS485 shield, it uses the default serial port to write and read, however I want to use a software serial. Can it be possible? I have also attached the schematics of the board. If yes, what pins to use and will they have to be wired separately
int led = 13;
int EN = 2; //Definition RS485 shield enable terminal (the 2nd digital IO ports),
//high for the sending state, the low level of receiving state
void setup() {
Serial.begin(9600);
pinMode(led, OUTPUT);
pinMode(EN, OUTPUT);
}
void loop() {
int temp;
digitalWrite(EN, LOW); //Enable low, RS485 shield waiting to receive data
if (Serial.available()) {
temp = Serial.read();
if (temp == 'V') {
digitalWrite(led, 1 - digitalRead(led));
digitalWrite(EN, HIGH); //Enable high, RS485 shield waiting to transmit data
Serial.println("OK");
delay(10); //Delay for some time, waiting for data transmitted
}
}
}