Arduino UNO Application Note page 6

Arduino uart interface to telaire t6613 co2 sensor
Hide thumbs Also See for UNO:
Table of Contents

Advertisement

int timeout=0; //set a timeoute counter
while(T66_Serial.available() < 5 ) //Wait to get a 7 byte response
{
timeout++;
if(timeout > 10) //if it takes to long there was probably an error
Serial.print("Timeout");
{
while(T66_Serial.available()) //flush whatever we have
T66_Serial.read();
break; //exit and try again
}
delay(50);
}
for (int i=0; i < 5; i++) response[i] = T66_Serial.read();
}
unsigned long getValue(byte packet[])
{
int high = packet[3]; //high byte for value is 4th byte in packet in the packet
int low = packet[4]; //low byte for value is 5th byte in the packet
unsigned long val = high*256 + low; //Combine high byte and low byte with this
formula to get value
return val;
}
© 16 March 2017 CO2Meter, Inc. All Rights Reserved 
 
 
 

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the UNO and is the answer not in the manual?

This manual is also suitable for:

MegaMega 2560

Table of Contents