Hello everyone,
I don't have much experience with the Arduino yet and am currently trying my first bigger project. However, I'm reaching my programming limits and look for advice in the forum.
The setting is as follows:
I have a pressure sensor from Keller and want to read it digitally via RS485 with the Arduino Mega. The MAX RS485 module is available and connected as shown in the picture.
The code I'm currently using is this:
int pressure = 0;
void setup() {
pinMode(19,INPUT); //RX
pinMode(18, OUTPUT); //TX
pinMode(13, INPUT);
Serial.begin(9600);
Serial1.begin(9600);
}
void loop() {
pinMode(13, OUTPUT);
digitalWrite(13, HIGH);
Serial1.print(2741467);
pinMode(13, INPUT);
digitalWrite(13, LOW);
delay(101);
if(Serial1.available()){
pressure = Serial1.read();
Serial.println(pressure);
}
However, I do not understand the data that I get displayed in the serial monitor. With Serial1.print I want to send the request for data to the sensor. But I don't know if I'm sending the right request and can't figure out the communication protocol of the sensor.
Can someone help me optimize the code so that I see the pressure values of the sensor?
I am looking forward to many answers.
Many greetings
L.
comm_protocol_e.zip (730 KB)