Hi,
here is the code that I have so far:
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX
int sensorValue = 0;
void setup() {
Serial.begin(19200); // Init serial to communicate with sensor.
mySerial.begin(9600); // Init softserial to communicate with other device.
}
void loop() {
// Send message to sensor, which make it send back data.
byte message[] = { 0x55, 0xAA, 0x7E, 0x02, 0x4F, 0x43, 0x94, 0x0E, 0x0D };
Serial.write(message, sizeof(message));
// Read the answer of the sensor.
while (Serial.available()) {
int readout = Serial.read();
/*** Code to interpret HEX answer of the sensor. ***/
}
// Send the extracted sensor value to other device over softserial.
mySerial.println("[" + String(sensorValue) + "]");
delay(2000);
}