0.3.2 Cozir

This commit is contained in:
rob tillaart 2021-12-14 19:05:30 +01:00
parent 3691d36272
commit 84dbb68989
10 changed files with 65 additions and 10 deletions

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2012-2021 Rob Tillaart
Copyright (c) 2012-2022 Rob Tillaart
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -184,12 +184,17 @@ Also the user must reset the operating mode either to **CZR_POLLING** or **CZR_S
## Future
- test test test test and ...
- improve documentation
- test test test test and buy a sensor
- add a **setEEPROMFactoryDefault()**?
- example two Cozir sensors
- example Cozir with I2C display?
- build a Arduino COZIR simulator for testing.
- Cozir I2C class for newer generation ~ same interface
- add other sensors underneath?
- ...
- Cozir I2C class for newer generation
~ same functional interface
- multiWire / pin a la PCF8574
## Operation

View File

@ -1,13 +1,14 @@
//
// FILE: Cozir.cpp
// AUTHOR: DirtGambit & Rob Tillaart
// VERSION: 0.3.1
// VERSION: 0.3.2
// PURPOSE: library for COZIR range of sensors for Arduino
// Polling Mode
// URL: https://github.com/RobTillaart/Cozir
// http://forum.arduino.cc/index.php?topic=91467.0
//
// HISTORY:
// 0.3.2 2021-12-14 update library.json, license, minor edits
// 0.3.1 2021-10-20 update Arduino-CI, badges in readme.md
// 0.3.0 2021-08-08 Major update - breaks interface (names mainly)
// add isInitialized(), add getOperatingMode(),

View File

@ -2,7 +2,7 @@
//
// FILE: Cozir.h
// AUTHOR: DirtGambit & Rob Tillaart
// VERSION: 0.3.1
// VERSION: 0.3.2
// PURPOSE: library for COZIR range of sensors for Arduino
// Polling Mode
// URL: https://github.com/RobTillaart/Cozir
@ -15,7 +15,7 @@
#include "Arduino.h"
#define COZIR_LIB_VERSION (F("0.3.1"))
#define COZIR_LIB_VERSION (F("0.3.2"))
// OUTPUTFIELDS

View File

@ -10,10 +10,12 @@
// Note: this sketch needs a MEGA or a Teensy that supports a second
// Serial port named Serial1
#include "cozir.h"
COZIR czr(&Serial1);
void setup()
{
Serial1.begin(9600);
@ -27,6 +29,7 @@ void setup()
delay(1000);
}
void loop()
{
float t = czr.celsius();
@ -43,4 +46,6 @@ void loop()
delay(3000);
}
// -- END OF FILE --

View File

@ -7,6 +7,7 @@
// URL: http://forum.arduino.cc/index.php?topic=91467.0
//
#include "cozir.h"
#include "SoftwareSerial.h"
@ -14,6 +15,7 @@ SoftwareSerial sws(3, 2);
COZIR czr(&sws);
void setup()
{
sws.begin(9600);
@ -27,6 +29,7 @@ void setup()
delay(1000);
}
void loop()
{
float t = czr.celsius();
@ -43,4 +46,6 @@ void loop()
delay(3000);
}
// -- END OF FILE --

View File

@ -10,10 +10,12 @@
// Note: this sketch needs a MEGA or a Teensy that supports a second
// Serial port named Serial1
#include "cozir.h"
COZIR czr(&Serial1);
void setup()
{
Serial1.begin(9600);
@ -45,6 +47,7 @@ void setup()
czr.setOperatingMode(CZR_POLLING);
}
void loop()
{
float t = czr.celsius();
@ -61,4 +64,6 @@ void loop()
delay(3000);
}
// -- END OF FILE --

View File

@ -18,8 +18,9 @@
"type": "git",
"url": "https://github.com/RobTillaart/Cozir.git"
},
"version": "0.3.1",
"version": "0.3.2",
"license": "MIT",
"frameworks": "arduino",
"platforms": "*"
"platforms": "*",
"headers": "cozir.h"
}

View File

@ -1,5 +1,5 @@
name=Cozir
version=0.3.1
version=0.3.2
author=Rob Tillaart <rob.tillaart@gmail.com>, DirtGambit
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Arduino library for COZIR range of CO2 sensors. Polling mode only.

View File

@ -45,16 +45,49 @@
// aspects of software serial
bool bigEndian = false;
unittest_setup()
{
fprintf(stderr, "\n");
fprintf(stderr, "COZIR_LIB_VERSION: %s\n", (char *) COZIR_LIB_VERSION);
}
unittest_teardown()
{
}
unittest(test_constants)
{
fprintf(stderr, "\noutput fields\n");
assertEqual(0x2000, CZR_LIGHT );
assertEqual(0x1000, CZR_HUMIDITY );
assertEqual(0x0800, CZR_FILTLED );
assertEqual(0x0400, CZR_RAWLED );
assertEqual(0x0200, CZR_MAXLED );
assertEqual(0x0100, CZR_ZEROPOINT );
assertEqual(0x0080, CZR_RAWTEMP );
assertEqual(0x0040, CZR_FILTTEMP );
assertEqual(0x0020, CZR_FILTLEDSIGNAL);
assertEqual(0x0010, CZR_RAWLEDSIGNAL );
assertEqual(0x0008, CZR_SENSTEMP );
assertEqual(0x0004, CZR_FILTCO2 );
assertEqual(0x0002, CZR_RAWCO2 );
assertEqual(0x0001, CZR_NONE );
assertEqual(0x1082, CZR_HTC );
assertEqual(0x3FFE, CZR_ALL );
fprintf(stderr, "\nmodi operandi\n");
assertEqual(0x00, CZR_COMMAND);
assertEqual(0x01, CZR_STREAMING);
assertEqual(0x02, CZR_POLLING);
}
unittest(test_software_serial)
{
int receivePin = 4;