mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
0.3.2 Cozir
This commit is contained in:
parent
3691d36272
commit
84dbb68989
@ -1,6 +1,6 @@
|
|||||||
MIT License
|
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
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -184,12 +184,17 @@ Also the user must reset the operating mode either to **CZR_POLLING** or **CZR_S
|
|||||||
|
|
||||||
## Future
|
## Future
|
||||||
|
|
||||||
- test test test test and ...
|
- improve documentation
|
||||||
|
- test test test test and buy a sensor
|
||||||
- add a **setEEPROMFactoryDefault()**?
|
- add a **setEEPROMFactoryDefault()**?
|
||||||
- example two Cozir sensors
|
- example two Cozir sensors
|
||||||
- example Cozir with I2C display?
|
- example Cozir with I2C display?
|
||||||
- build a Arduino COZIR simulator for testing.
|
- 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
|
## Operation
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
//
|
//
|
||||||
// FILE: Cozir.cpp
|
// FILE: Cozir.cpp
|
||||||
// AUTHOR: DirtGambit & Rob Tillaart
|
// AUTHOR: DirtGambit & Rob Tillaart
|
||||||
// VERSION: 0.3.1
|
// VERSION: 0.3.2
|
||||||
// PURPOSE: library for COZIR range of sensors for Arduino
|
// PURPOSE: library for COZIR range of sensors for Arduino
|
||||||
// Polling Mode
|
// Polling Mode
|
||||||
// URL: https://github.com/RobTillaart/Cozir
|
// URL: https://github.com/RobTillaart/Cozir
|
||||||
// http://forum.arduino.cc/index.php?topic=91467.0
|
// http://forum.arduino.cc/index.php?topic=91467.0
|
||||||
//
|
//
|
||||||
// HISTORY:
|
// 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.1 2021-10-20 update Arduino-CI, badges in readme.md
|
||||||
// 0.3.0 2021-08-08 Major update - breaks interface (names mainly)
|
// 0.3.0 2021-08-08 Major update - breaks interface (names mainly)
|
||||||
// add isInitialized(), add getOperatingMode(),
|
// add isInitialized(), add getOperatingMode(),
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
//
|
//
|
||||||
// FILE: Cozir.h
|
// FILE: Cozir.h
|
||||||
// AUTHOR: DirtGambit & Rob Tillaart
|
// AUTHOR: DirtGambit & Rob Tillaart
|
||||||
// VERSION: 0.3.1
|
// VERSION: 0.3.2
|
||||||
// PURPOSE: library for COZIR range of sensors for Arduino
|
// PURPOSE: library for COZIR range of sensors for Arduino
|
||||||
// Polling Mode
|
// Polling Mode
|
||||||
// URL: https://github.com/RobTillaart/Cozir
|
// URL: https://github.com/RobTillaart/Cozir
|
||||||
@ -15,7 +15,7 @@
|
|||||||
#include "Arduino.h"
|
#include "Arduino.h"
|
||||||
|
|
||||||
|
|
||||||
#define COZIR_LIB_VERSION (F("0.3.1"))
|
#define COZIR_LIB_VERSION (F("0.3.2"))
|
||||||
|
|
||||||
|
|
||||||
// OUTPUTFIELDS
|
// OUTPUTFIELDS
|
||||||
|
@ -10,10 +10,12 @@
|
|||||||
// Note: this sketch needs a MEGA or a Teensy that supports a second
|
// Note: this sketch needs a MEGA or a Teensy that supports a second
|
||||||
// Serial port named Serial1
|
// Serial port named Serial1
|
||||||
|
|
||||||
|
|
||||||
#include "cozir.h"
|
#include "cozir.h"
|
||||||
|
|
||||||
COZIR czr(&Serial1);
|
COZIR czr(&Serial1);
|
||||||
|
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
Serial1.begin(9600);
|
Serial1.begin(9600);
|
||||||
@ -27,6 +29,7 @@ void setup()
|
|||||||
delay(1000);
|
delay(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
float t = czr.celsius();
|
float t = czr.celsius();
|
||||||
@ -43,4 +46,6 @@ void loop()
|
|||||||
delay(3000);
|
delay(3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// -- END OF FILE --
|
// -- END OF FILE --
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
// URL: http://forum.arduino.cc/index.php?topic=91467.0
|
// URL: http://forum.arduino.cc/index.php?topic=91467.0
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
#include "cozir.h"
|
#include "cozir.h"
|
||||||
#include "SoftwareSerial.h"
|
#include "SoftwareSerial.h"
|
||||||
|
|
||||||
@ -14,6 +15,7 @@ SoftwareSerial sws(3, 2);
|
|||||||
|
|
||||||
COZIR czr(&sws);
|
COZIR czr(&sws);
|
||||||
|
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
sws.begin(9600);
|
sws.begin(9600);
|
||||||
@ -27,6 +29,7 @@ void setup()
|
|||||||
delay(1000);
|
delay(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
float t = czr.celsius();
|
float t = czr.celsius();
|
||||||
@ -43,4 +46,6 @@ void loop()
|
|||||||
delay(3000);
|
delay(3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// -- END OF FILE --
|
// -- END OF FILE --
|
||||||
|
|
||||||
|
@ -10,10 +10,12 @@
|
|||||||
// Note: this sketch needs a MEGA or a Teensy that supports a second
|
// Note: this sketch needs a MEGA or a Teensy that supports a second
|
||||||
// Serial port named Serial1
|
// Serial port named Serial1
|
||||||
|
|
||||||
|
|
||||||
#include "cozir.h"
|
#include "cozir.h"
|
||||||
|
|
||||||
COZIR czr(&Serial1);
|
COZIR czr(&Serial1);
|
||||||
|
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
Serial1.begin(9600);
|
Serial1.begin(9600);
|
||||||
@ -45,6 +47,7 @@ void setup()
|
|||||||
czr.setOperatingMode(CZR_POLLING);
|
czr.setOperatingMode(CZR_POLLING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
float t = czr.celsius();
|
float t = czr.celsius();
|
||||||
@ -61,4 +64,6 @@ void loop()
|
|||||||
delay(3000);
|
delay(3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// -- END OF FILE --
|
// -- END OF FILE --
|
||||||
|
|
||||||
|
@ -18,8 +18,9 @@
|
|||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/RobTillaart/Cozir.git"
|
"url": "https://github.com/RobTillaart/Cozir.git"
|
||||||
},
|
},
|
||||||
"version": "0.3.1",
|
"version": "0.3.2",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"frameworks": "arduino",
|
"frameworks": "arduino",
|
||||||
"platforms": "*"
|
"platforms": "*",
|
||||||
|
"headers": "cozir.h"
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
name=Cozir
|
name=Cozir
|
||||||
version=0.3.1
|
version=0.3.2
|
||||||
author=Rob Tillaart <rob.tillaart@gmail.com>, DirtGambit
|
author=Rob Tillaart <rob.tillaart@gmail.com>, DirtGambit
|
||||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||||
sentence=Arduino library for COZIR range of CO2 sensors. Polling mode only.
|
sentence=Arduino library for COZIR range of CO2 sensors. Polling mode only.
|
||||||
|
@ -45,16 +45,49 @@
|
|||||||
// aspects of software serial
|
// aspects of software serial
|
||||||
bool bigEndian = false;
|
bool bigEndian = false;
|
||||||
|
|
||||||
|
|
||||||
unittest_setup()
|
unittest_setup()
|
||||||
{
|
{
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "COZIR_LIB_VERSION: %s\n", (char *) COZIR_LIB_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unittest_teardown()
|
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)
|
unittest(test_software_serial)
|
||||||
{
|
{
|
||||||
int receivePin = 4;
|
int receivePin = 4;
|
||||||
|
Loading…
Reference in New Issue
Block a user