2020-11-27 11:10:47 +01:00
|
|
|
//
|
|
|
|
// FILE: CozirDemoHardwareSerial.ino
|
|
|
|
// AUTHOR: Rob Tillaart
|
|
|
|
// VERSION: 0.1.1
|
|
|
|
// PURPOSE: demo of Cozir lib (>= 0.1.06)
|
|
|
|
// DATE: 2015-jan-17
|
|
|
|
// URL: http://forum.arduino.cc/index.php?topic=91467.0
|
|
|
|
//
|
|
|
|
|
|
|
|
// Note: this sketch needs a MEGA or a Teensy that supports a second
|
|
|
|
// Serial port named Serial1
|
|
|
|
|
2021-12-14 19:05:30 +01:00
|
|
|
|
2021-01-29 12:31:58 +01:00
|
|
|
#include "cozir.h"
|
2020-11-27 11:10:47 +01:00
|
|
|
|
|
|
|
COZIR czr(&Serial1);
|
|
|
|
|
2021-12-14 19:05:30 +01:00
|
|
|
|
2020-11-27 11:10:47 +01:00
|
|
|
void setup()
|
|
|
|
{
|
|
|
|
Serial1.begin(9600);
|
|
|
|
czr.init();
|
|
|
|
|
|
|
|
Serial.begin(115200);
|
|
|
|
Serial.print("Cozir HardwareSerial: ");
|
|
|
|
Serial.println(COZIR_LIB_VERSION);
|
|
|
|
Serial.println();
|
|
|
|
|
|
|
|
delay(1000);
|
|
|
|
}
|
|
|
|
|
2021-12-14 19:05:30 +01:00
|
|
|
|
2020-11-27 11:10:47 +01:00
|
|
|
void loop()
|
|
|
|
{
|
2021-08-15 19:38:45 +02:00
|
|
|
float t = czr.celsius();
|
|
|
|
float f = czr.fahrenheit();
|
|
|
|
float h = czr.humidity();
|
2020-11-27 11:10:47 +01:00
|
|
|
uint32_t c = czr.CO2();
|
|
|
|
|
|
|
|
Serial.print("Celcius =\t"); Serial.println(t);
|
|
|
|
Serial.print("Fahrenheit =\t"); Serial.println(f);
|
|
|
|
Serial.print("Humidity =\t"); Serial.println(h);
|
|
|
|
Serial.print("CO2 =\t"); Serial.println(c);
|
|
|
|
Serial.println();
|
|
|
|
|
|
|
|
delay(3000);
|
|
|
|
}
|
|
|
|
|
2021-12-14 19:05:30 +01:00
|
|
|
|
2020-11-27 11:10:47 +01:00
|
|
|
// -- END OF FILE --
|
2021-12-14 19:05:30 +01:00
|
|
|
|