Hello I have a couple of Air sensor that sends data with this format every second:
FF 01 86 00 00 00 00 00 79
so I tried using serial methods but nothing happens.
Currently I', using this code:
int incomingByte = 0; // for incoming serial data
void setup() {
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
Serial2.begin(9600);
Serial2.write(0x78);
Serial.write("hello");
}
void loop() {
// send data only when you receive data:
Serial2.write(0x86);
if (Serial2.available() > 0) {
// read the incoming byte:
incomingByte = Serial2.read();
// say what you got:
Serial.print("I received: ");
Serial.println(incomingByte, HEX);
}
}
I'm using an arduino mega and tried with two sensors of the same type.
Here is the sensor datasheet https://drive.google.com/file/d/0B8Mi_v8zeSRsd3JwYnBvMnRnVVk/view?usp=sharing
Am I doing something wrong?
thanks