Hi guys,
Bit of a challenge here, i recently purchased a sensor online and i wanted to use my arduino to communicate with it.
It uses RS485 protocol and i have attached the datasheet below.
i am using a max485 breakout.
i have tried the following code without success:
int enablePin = 8; // DE and RE tied to pin 8
byte msg [] = {
0xFF,
0x03,
0x00,
0x00,
0x00,
0x01,
0x91,
0xD4// end byte
};
void setup()
{
Serial.begin(9600);
pinMode(enablePin, OUTPUT);
delay(10);
digitalWrite(enablePin, HIGH);
}
void loop()
{
for (int i = 0; i < 8; i++)
{
Serial.print(msg[i], HEX);
}
delay(5000);
}
i used a software to communicate over a USB to rs485 converter and i was able to get a result (screenshot below)
can anyone assist me with this?