![rs485 – Turning on and off the built-in led in Arduino Portenta Machine Management utilizing HMI rs485 – Turning on and off the built-in led in Arduino Portenta Machine Management utilizing HMI](https://techtoguide.com/wp-content/uploads/2023/10/Why-wont-my-servo-and-ultrasonic-sensor-work-together.png)
[ad_1]
I’m new to this Arduino Portenta Machine Management (PMC) board. Sadly I can’t discover many sources on this specific board. I’m attempting to implement communication between HMI (Delta DOP-103BQ) and an Arduino Portenta machine management utilizing modbus communication by RS485 cable, to regulate the LED state within the PMC by enabling/disabling the button within the HMI.
I created a easy mission within the DIA display screen software program, positioned a button within the display screen and gave the learn tackle as B2 in Link2 kind.
I wrote this Arduino code on my own, please level out what I did improper within the code…
#embrace <ArduinoRS485.h>
#embrace <ArduinoModbus.h>
#embrace <Arduino_MachineControl.h>
arduino::UART _UART0_{ PA_0, PI_9, NC, NC };
RS485Class rs485{ _UART0_, PinNameToIndex(PA_0), PinNameToIndex(PI_13), PinNameToIndex(PI_10) };
machinecontrol::DigitalOutputsClass digital_outputs;
void setup(){
Serial.start(115200);
Serial.println("Begin");
digital_outputs.setLatch();
rs485.setDelays(1,1);
ModbusRTUServer.start(rs485,1, 115200, SERIAL_8N1);
ModbusRTUServer.configureCoils(0x00, 10);
ModbusRTUServer.configureHoldingRegisters(0x00, 10);
if(ModbusRTUServer.holdingRegisterRead(0x01) == 1){
digital_outputs.setAll(255);
Serial.println("All Channels/led's turned on");
} else {
digital_outputs.setAll(0);
Serial.println("All Channels/led's turned off");
}
}
void loop() {
ModbusRTUServer.ballot();
}
I do not know which operate code to make use of to make the communication occur. All I wish to do is make this built-in LED activate and off once I press the button within the HMI.
Wire connection:
RS485 cable for connecting the HMI and Arduino PMC in RS485 cable-
brown wire linked to the RXN485 pin
yellow wire linked to the TXN485 pin
inexperienced linked to floor.
I’d be glad if anybody may assist me with this.
[ad_2]