mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-09-19 16:46:11 -04:00
+ 0.1.04 Cozir
+ added history + changed CO2() to support larger values - uint32_t + added URL + reformatted layout
This commit is contained in:
parent
3ef3907e67
commit
4f3ecf096c
@ -1,10 +1,16 @@
|
||||
//
|
||||
// FILE: Cozir.cpp
|
||||
// AUTHOR: DirtGambit & Rob Tillaart
|
||||
// VERSION: 0.1.03
|
||||
// VERSION: 0.1.04
|
||||
// PURPOSE: library for COZIR range of sensors for Arduino
|
||||
// Polling Mode
|
||||
// URL:
|
||||
// URL: http://forum.arduino.cc/index.php?topic=91467.0
|
||||
//
|
||||
// HISTORY:
|
||||
// 0.1.04 changed CO2 to support larger values (Rob T)
|
||||
// 0.1.03 added setOperatingMode
|
||||
// 0.1.02 added support Arduino 1.x
|
||||
// 0.1.01 initial version
|
||||
//
|
||||
// READ DATASHEET BEFORE USE OF THIS LIB !
|
||||
//
|
||||
@ -24,7 +30,7 @@
|
||||
#endif
|
||||
{
|
||||
nss.begin(9600);
|
||||
// overide default streaming (takes to much perf
|
||||
// overide default streaming (takes too much perf
|
||||
SetOperatingMode(CZR_POLLING);
|
||||
// delay for initialization
|
||||
delay(1200);
|
||||
@ -76,7 +82,7 @@ float COZIR::Light()
|
||||
return 1.0 * Request("L");
|
||||
}
|
||||
|
||||
uint16_t COZIR::CO2()
|
||||
uint32_t COZIR::CO2()
|
||||
{
|
||||
return Request("Z");
|
||||
}
|
||||
@ -217,11 +223,13 @@ void COZIR::GetConfiguration()
|
||||
|
||||
void COZIR::Command(const char* s)
|
||||
{
|
||||
// TODO
|
||||
// CZR_Serial.println(s);
|
||||
CZR_Serial.print(s);
|
||||
CZR_Serial.print("\r\n");
|
||||
}
|
||||
|
||||
uint16_t COZIR::Request(const char* s)
|
||||
uint32_t COZIR::Request(const char* s)
|
||||
{
|
||||
Command(s);
|
||||
// empty buffer
|
||||
@ -236,7 +244,7 @@ uint16_t COZIR::Request(const char* s)
|
||||
}
|
||||
buffer[idx] = '\0';
|
||||
|
||||
uint16_t rv = 0;
|
||||
uint32_t rv = 0;
|
||||
switch(buffer[0])
|
||||
{
|
||||
case 'T' :
|
||||
@ -245,7 +253,7 @@ uint16_t COZIR::Request(const char* s)
|
||||
// negative values are mapped above 1000..1250 => capture this in Celsius()
|
||||
break;
|
||||
default :
|
||||
rv = atoi(&buffer[2]);
|
||||
rv = atol(&buffer[2]);
|
||||
break;
|
||||
}
|
||||
return rv;
|
||||
|
@ -1,10 +1,10 @@
|
||||
//
|
||||
// FILE: Cozir.h
|
||||
// AUTHOR: DirtGambit & Rob Tillaart
|
||||
// VERSION: see COZIR_LIB_VERSION
|
||||
// VERSION: 0.1.04
|
||||
// PURPOSE: library for COZIR range of sensors for Arduino
|
||||
// Polling Mode
|
||||
// URL:
|
||||
// URL: http://forum.arduino.cc/index.php?topic=91467.0
|
||||
//
|
||||
// READ DATASHEET BEFORE USE OF THIS LIB !
|
||||
//
|
||||
@ -22,7 +22,7 @@
|
||||
#include "NewSoftSerial.h"
|
||||
#endif
|
||||
|
||||
#define COZIR_LIB_VERSION "0.1.03"
|
||||
#define COZIR_LIB_VERSION "0.1.04"
|
||||
|
||||
// OUTPUTFIELDS
|
||||
// See datasheet for details.
|
||||
@ -65,7 +65,7 @@ class COZIR
|
||||
float Fahrenheit();
|
||||
float Humidity();
|
||||
float Light();
|
||||
uint16_t CO2();
|
||||
uint32_t CO2();
|
||||
|
||||
uint16_t FineTuneZeroPoint(uint16_t , uint16_t);
|
||||
uint16_t CalibrateFreshAir();
|
||||
|
Loading…
Reference in New Issue
Block a user