Hey guys quick question.
I am communicating with this CO2 sensor. When I pass it a hex string over serial to the arduino and then arduino communicates to the sensor over the software serial it works perfectly.
When I am passing a hex string from python, this code works perfectly.
if (mySerial.available())
{
Serial.print((char)mySerial.read());
}
if (Serial.available())
{
mySerial.print((char)Serial.read());
}
Except that when I try to replace this
if (Serial.available())
{
mySerial.print((char)Serial.read());
}
with hard coded bytes I'm passing to the sensor
mySerial.print(byte(254));
mySerial.print(byte(04));
mySerial.print(byte(00));
mySerial.print(byte(03));
mySerial.print(byte(00));
mySerial.print(byte(01));
mySerial.print(byte(213));
mySerial.print(byte(197));
It only works once and any other communication back is empty.
Any suggestions.
BTW the hex string I'm sending from python over serial is
'\xfe\x04\x00\x03\x00\x01\xd5\xc5'
Any help or advice is appreciated.
Alternatively if someone can tell me if it's possible to send a hex string using Amarino (android meets arduino) such that I can pass the hex string to the sensor and use the (working) first code.