0.4.0 AGS02MA

This commit is contained in:
Rob Tillaart 2023-12-06 19:16:29 +01:00
parent b32f817808
commit 45f3123c3f
23 changed files with 387 additions and 132 deletions

View File

@ -2,7 +2,7 @@
// FILE: AGS02MA.cpp
// AUTHOR: Rob Tillaart, Viktor Balint, Beanow
// DATE: 2021-08-12
// VERSION: 0.3.4
// VERSION: 0.4.0
// PURPOSE: Arduino library for AGS02MA TVOC sensor
// URL: https://github.com/RobTillaart/AGS02MA
@ -26,25 +26,9 @@ AGS02MA::AGS02MA(const uint8_t deviceAddress, TwoWire *wire)
}
#if defined (ESP8266) || defined(ESP32)
bool AGS02MA::begin(uint8_t dataPin, uint8_t clockPin)
{
_startTime = millis(); // PREHEAT
if ((dataPin < 255) && (clockPin < 255))
{
_wire->begin(dataPin, clockPin);
} else {
_wire->begin();
}
return isConnected();
}
#endif
bool AGS02MA::begin()
{
_startTime = millis(); // PREHEAT TIMING
_wire->begin();
return isConnected();
}

View File

@ -3,7 +3,7 @@
// FILE: AGS02MA.h
// AUTHOR: Rob Tillaart, Viktor Balint, Beanow
// DATE: 2021-08-12
// VERSION: 0.3.4
// VERSION: 0.4.0
// PURPOSE: Arduino library for AGS02MA TVOC sensor
// URL: https://github.com/RobTillaart/AGS02MA
//
@ -13,7 +13,7 @@
#include "Wire.h"
#define AGS02MA_LIB_VERSION (F("0.3.4"))
#define AGS02MA_LIB_VERSION (F("0.4.0"))
#define AGS02MA_OK 0
#define AGS02MA_ERROR -10
@ -51,9 +51,6 @@ public:
// address 26 = 0x1A
explicit AGS02MA(const uint8_t deviceAddress = 26, TwoWire *wire = &Wire);
#if defined (ESP8266) || defined(ESP32)
bool begin(uint8_t sda, uint8_t scl);
#endif
bool begin();
bool isConnected();
void reset();
@ -102,7 +99,7 @@ public:
float lastPPM() { return _lastPPB * 0.001; };
uint32_t lastPPB() { return _lastPPB; }; // fetch last PPB measurement
uint32_t lastUGM3() { return _lastUGM3; }; // fetch last UGM3 measurement
uint32_t lastUGM3() { return _lastUGM3; }; // fetch last UGM3 measurement
// STATUS

View File

@ -6,12 +6,17 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [0.4.0] - 2023-12-06
- refactor API, begin()
- update readme.md
----
## [0.3.4] - 2023-09-25
- add Wire1 support for ESP32
- update readme.md
- minor edits
## [0.3.3] - 2023-01-21
- update GitHub actions
- update license 2023

View File

@ -13,11 +13,23 @@
Arduino library for AGS02MA TVOC sensor.
#### Description
This library is still experimental, so please use with care.
Note the warning about the I2C low speed, the device works at max 30 KHz.
Since 0.3.1 this library uses 25 KHz.
#### 0.4.0 Breaking change
Version 0.4.0 introduced a breaking change.
You cannot set the pins in **begin()** any more.
This reduces the dependency of processor dependent Wire implementations.
The user has to call **Wire.begin()** and can optionally set the Wire pins
before calling **begin()**.
## I2C
### PIN layout from left to right
@ -101,12 +113,11 @@ with the sensor and this (or other) library.
#include "AGS02MA.h"
```
#### Constructor
- **AGS02MA(uint8_t deviceAddress = 26, TwoWire \*wire = &Wire)** constructor, with default address and default I2C interface.
- **bool begin(uint8_t sda, uint8_t scl)** begin for ESP32 and ESP8266.
- **bool begin()** initializer for Arduino UNO a.o.
- **AGS02MA(uint8_t deviceAddress = 26, TwoWire \*wire = &Wire)** constructor,
with default address and default I2C interface.
- **bool begin()** initialize the library.
- **bool isConnected()** returns true if device address can be seen on I2C.
- **void reset()** reset internal variables.
@ -157,6 +168,7 @@ The default mode at startup of the sensor is PPB = parts per billion.
- **bool setUGM3Mode()** sets device in micro gram per cubic meter mode. Returns true on success.
- **uint8_t getMode()** returns mode set. 0 = PPB, 1 = UGm3, 255 = not set.
#### Air quality classification
| ppm | Class |
@ -171,6 +183,7 @@ The default mode at startup of the sensor is PPB = parts per billion.
[Source](https://learn.kaiterra.com/en/resources/understanding-tvoc-volatile-organic-compounds)
#### PPB versus UGM3
There is no 1 to 1 relation between the PPB and the uG/m3 readings as this relation depends

View File

@ -1,11 +1,8 @@
//
// FILE: AGS02MA_PPB.ino
// AUTHOR: Rob Tillaart
// VERSION: 0.1.0
// PURPOSE: test application
// DATE: 2021-08-12
// URL: https://github.com/RobTillaart/AGS02MA
//
#include "AGS02MA.h"
@ -16,15 +13,18 @@ AGS02MA AGS(26);
void setup()
{
// ESP devices typically miss the first serial log lines after flashing.
// Delay somewhat to include all output.
delay(1000);
Serial.begin(115200);
Serial.println(__FILE__);
Wire.begin();
Serial.print("AGS02MA_LIB_VERSION: ");
Serial.println(AGS02MA_LIB_VERSION);
Serial.println();
Wire.begin();
bool b = AGS.begin();
Serial.print("BEGIN:\t");
Serial.println(b);
@ -32,8 +32,8 @@ void setup()
Serial.print("VERSION:\t");
Serial.println(AGS.getSensorVersion());
// pre-heating improves measurement quality
// can be skipped
// pre-heating improves measurement quality
// can be skipped
Serial.println("\nWarming up (120 seconds = 24 dots)");
while (AGS.isHeated() == false)
{
@ -70,4 +70,4 @@ void loop()
}
// -- END OF FILE --
// -- END OF FILE --

View File

@ -15,15 +15,18 @@ AGS02MA AGS(26);
void setup()
{
// ESP devices typically miss the first serial log lines after flashing.
// Delay somewhat to include all output.
delay(1000);
Serial.begin(115200);
Serial.println(__FILE__);
Wire.begin();
Serial.print("AGS02MA_LIB_VERSION: ");
Serial.println(AGS02MA_LIB_VERSION);
Serial.println();
Wire.begin();
bool b = AGS.begin();
Serial.print("BEGIN:\t");
Serial.println(b);
@ -31,8 +34,8 @@ void setup()
Serial.print("VERS:\t");
Serial.println(AGS.getSensorVersion());
// pre-heating improves measurement quality
// can be skipped
// pre-heating improves measurement quality
// can be skipped
Serial.println("\nWarming up (120 seconds = 24 dots)");
while (AGS.isHeated() == false)
{
@ -69,5 +72,5 @@ void loop()
}
// -- END OF FILE --
// -- END OF FILE --

View File

@ -15,15 +15,18 @@ AGS02MA AGS(26);
void setup()
{
// ESP devices typically miss the first serial log lines after flashing.
// Delay somewhat to include all output.
delay(1000);
Serial.begin(115200);
Serial.println(__FILE__);
Wire.begin();
Serial.print("AGS02MA_LIB_VERSION: ");
Serial.println(AGS02MA_LIB_VERSION);
Serial.println();
Wire.begin();
bool b = AGS.begin();
Serial.print("BEGIN:\t");
Serial.println(b);
@ -31,8 +34,8 @@ void setup()
Serial.print("VERSION:\t");
Serial.println(AGS.getSensorVersion());
// pre-heating improves measurement quality
// can be skipped
// pre-heating improves measurement quality
// can be skipped
Serial.println("\nWarming up (120 seconds = 24 dots)");
while (AGS.isHeated() == false)
{
@ -65,5 +68,5 @@ void loop()
}
// -- END OF FILE --
// -- END OF FILE --

View File

@ -1,11 +1,8 @@
//
// FILE: AGS02MA_UGM3.ino
// AUTHOR: Rob Tillaart
// VERSION: 0.1.0
// PURPOSE: test application
// DATE: 2021-08-12
// URL: https://github.com/RobTillaart/AGS02MA
//
#include "AGS02MA.h"
@ -16,21 +13,24 @@ AGS02MA AGS(26);
void setup()
{
// ESP devices typically miss the first serial log lines after flashing.
// Delay somewhat to include all output.
delay(1000);
Serial.begin(115200);
Serial.println(__FILE__);
Wire.begin();
Serial.print("AGS02MA_LIB_VERSION: ");
Serial.println(AGS02MA_LIB_VERSION);
Serial.println();
Wire.begin();
bool b = AGS.begin();
Serial.print("BEGIN:\t");
Serial.println(b);
// pre-heating improves measurement quality
// can be skipped
// pre-heating improves measurement quality
// can be skipped
Serial.println("\nWarming up (120 seconds = 24 dots)");
while (AGS.isHeated() == false)
{
@ -67,4 +67,4 @@ void loop()
}
// -- END OF FILE --
// -- END OF FILE --

View File

@ -1,15 +1,13 @@
//
// FILE: AGS02MA_calibrate.ino
// AUTHOR: Rob Tillaart, Beanow
// VERSION: 0.2.0
// PURPOSE: test application
// DATE: 2021-08-12
// URL: https://github.com/RobTillaart/AGS02MA
//
#include "AGS02MA.h"
// You can decrease/disable warmup when you're certain the chip already warmed up.
// You can decrease/disable warmup when you're certain the chip already warmed up.
#define WARMUP_MINUTES 6
#define READ_INTERVAL 3000
@ -22,13 +20,12 @@ AGS02MA AGS(26);
void setup()
{
// ESP devices typically mis the first serial log lines after flashing.
// Delay somewhat to include all output.
// ESP devices typically miss the first serial log lines after flashing.
// Delay somewhat to include all output.
delay(1000);
Serial.begin(115200);
Serial.println(__FILE__);
Serial.print("AGS02MA_LIB_VERSION: ");
Serial.println(AGS02MA_LIB_VERSION);
Serial.println();
@ -49,7 +46,7 @@ void setup()
Serial.println(version);
int err = AGS.lastError();
// Reading version correctly matters, as we display additional comments based on it.
// Reading version correctly matters, as we display additional comments based on it.
if(err != AGS02MA_OK)
{
Serial.print("Error reading version:\t");
@ -101,7 +98,7 @@ void setup()
delay(1000);
// returns 1 if successful written
// returns 1 if successful written
b = AGS.zeroCalibration();
Serial.println();
Serial.print("CALIB:\t");
@ -123,8 +120,8 @@ void setup()
Serial.println();
Serial.println("Showing what PPB values look like post calibration.");
// A 125 status is typically shown on v118's after they've been powered off.
// Either having this version at all, or seeing this status, we'll display a notice.
// A 125 status is typically shown on v118's after they've been powered off.
// Either having this version at all, or seeing this status, we'll display a notice.
if (version == 118 || initialValue.status == 125)
{
Serial.println("NOTICE: v118 sensors are known to give different results after powering off!");
@ -162,4 +159,5 @@ void printPPB()
Serial.println();
}
// -- END OF FILE --
// -- END OF FILE --

View File

@ -1,15 +1,14 @@
//
// FILE: AGS02MA_calibrate_manual.ino
// AUTHOR: Rob Tillaart, Beanow
// VERSION: 0.2.0
// PURPOSE: test application
// DATE: 2022-04-22
// URL: https://github.com/RobTillaart/AGS02MA
//
#include "AGS02MA.h"
// The zero calibration value we'll (temporarily) set in the example.
// The zero calibration value we'll (temporarily) set in the example.
#define ZC_VALUE 700
#define READS 10
@ -24,13 +23,12 @@ uint8_t version;
void setup()
{
// ESP devices typically mis the first serial log lines after flashing.
// Delay somewhat to include all output.
// ESP devices typically miss the first serial log lines after flashing.
// Delay somewhat to include all output.
delay(1000);
Serial.begin(115200);
Serial.println(__FILE__);
Serial.print("AGS02MA_LIB_VERSION: ");
Serial.println(AGS02MA_LIB_VERSION);
Serial.println();
@ -51,7 +49,7 @@ void setup()
Serial.println(version);
int err = AGS.lastError();
// Reading version correctly matters, as we display additional comments based on it.
// Reading version correctly matters, as we display additional comments based on it.
if(err != AGS02MA_OK)
{
Serial.print("Error reading version:\t");
@ -130,7 +128,6 @@ void setup()
printZeroCalibrationData(restoredValue);
Serial.println();
}
}
@ -171,4 +168,5 @@ void printPPB()
Serial.println();
}
// -- END OF FILE --
// -- END OF FILE --

View File

@ -0,0 +1,28 @@
platforms:
rpipico:
board: rp2040:rp2040:rpipico
package: rp2040:rp2040
gcc:
features:
defines:
- ARDUINO_ARCH_RP2040
warnings:
flags:
packages:
rp2040:rp2040:
url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
compile:
# Choosing to run compilation tests on 2 different Arduino platforms
platforms:
# - uno
# - due
# - zero
# - leonardo
# - m4
# - esp32
# - esp8266
# - mega2560
# - rpipico

View File

@ -0,0 +1,107 @@
//
// FILE: AGS02MA_get_registers.ino
// AUTHOR: Rob Tillaart
// PURPOSE: low level develop application
// URL: https://github.com/RobTillaart/AGS02MA
//
// PURPOSE: this is a debugging tool for developing / investigating.
// Do not use it unless you are willing to crash your sensor.
//
// usage: make _readRegister(), _writeRegister() and _buffer public
//
// USE AT OWN RISK
#include "AGS02MA.h"
AGS02MA AGS(26);
void setup()
{
Serial.begin(115200);
Serial.println(__FILE__);
Serial.print("AGS02MA_LIB_VERSION: ");
Serial.println(AGS02MA_LIB_VERSION);
Serial.println();
Wire.begin();
bool b = AGS.begin();
Serial.print("BEGIN:\t");
Serial.println(b);
uint8_t version = AGS.getSensorVersion();
Serial.print("VERS:\t");
Serial.println(version);
// AGS._buffer[0] = 0;
// AGS._buffer[1] = 13;
// AGS._buffer[2] = 14;
// AGS._buffer[3] = 90;
// AGS._buffer[5] = 248;
// int x = AGS._writeRegister(0x01); // does not work.
// Serial.println(x);
for (uint8_t reg = 0; reg < 9; reg++)
{
dumpRegister(reg);
}
dumpRegister(0x11);
dumpRegister(0x20);
dumpRegister(0x21);
AGS.setPPBMode();
}
void loop()
{
// dumpRegister(0);
// uint32_t zero = dumpRegister(1);
// uint32_t x = dumpRegister(0x20); // seems to be the raw value.
// delay(100);
// uint32_t y = AGS.readPPB();
// Serial.print(zero);
// Serial.print("\t");
// Serial.print(x);
// Serial.print("\t");
// Serial.print(y);
// Serial.print("\t");
// Serial.print((1.0 * x) / y, 2);
// Serial.print("\t");
// Serial.print((zero - x) / 350);
// Serial.println();
// Serial.println();
// delay(2000);
}
uint32_t dumpRegister(uint8_t reg)
{
Serial.print("REG[");
Serial.print(reg);
Serial.print("]");
bool b = AGS._readRegister(reg);
uint32_t value = 0;
for (int i = 0; i < 4; i++)
{
Serial.print("\t");
Serial.print(AGS._buffer[i]);
value *= 256;
value += AGS._buffer[i];
}
Serial.print("\t");
Serial.print(value);
Serial.println();
delay(100);
return value;
}
// -- END OF FILE --

View File

@ -1,15 +1,13 @@
//
// FILE: AGS02MA_minimal.ino
// AUTHOR: Rob Tillaart
// VERSION: 0.1.1
// PURPOSE: test application
// DATE: 2021-08-14
// URL: https://github.com/RobTillaart/AGS02MA
//
// default register is 0x00 at start of the sensor
// datasheet states one can get the value with minimal interaction.
// note this sketch does not use the library!
// default register is 0x00 at start of the sensor
// datasheet states one can get the value with minimal interaction.
// note this sketch does not use the library!
#include "Wire.h"
@ -20,10 +18,18 @@ uint8_t buffer[5];
void setup()
{
// ESP devices typically miss the first serial log lines after flashing.
// Delay somewhat to include all output.
delay(1000);
Serial.begin(115200);
Serial.println(__FILE__);
// Serial.print("AGS02MA_LIB_VERSION: ");
// Serial.println(AGS02MA_LIB_VERSION);
Serial.println();
Wire.begin();
Wire.setClock(30400); // lowest speed an UNO supports that works with sensor.
Wire.setClock(30400); // lowest speed an UNO supports that works with sensor.
}
@ -39,7 +45,7 @@ void loop()
}
Serial.println();
// CONVERT RAW DATA
// CONVERT RAW DATA
Serial.print("STAT:\t");
Serial.println(buffer[0]);
Serial.print("PPB:\t");
@ -50,4 +56,4 @@ void loop()
}
// -- END OF FILE --
// -- END OF FILE --

View File

@ -21,10 +21,18 @@ uint8_t cnt = 0;
void setup()
{
// ESP devices typically miss the first serial log lines after flashing.
// Delay somewhat to include all output.
delay(1000);
Serial.begin(115200);
// Serial.println(__FILE__);
// Serial.print("AGS02MA_LIB_VERSION: ");
// Serial.println(AGS02MA_LIB_VERSION);
// Serial.println();
Wire.begin();
Wire.setClock(30400); // lowest speed an UNO supports that works with sensor.
Wire.setClock(30400); // lowest speed an UNO supports that works with sensor.
}
@ -34,14 +42,14 @@ void loop()
for ( int i = 0; i < 5; i++)
{
buffer[i] = Wire.read();
// Serial.print(buffer[i], HEX); // for debugging.
// Serial.print(buffer[i], HEX); // for debugging.
// Serial.print('\t');
}
// Serial.println();
if (cnt == 0)
{
// CONVERT RAW DATA
// CONVERT RAW DATA
Serial.println("\nSTAT\tPPB\tCRC");
cnt = 20;
}
@ -59,4 +67,4 @@ void loop()
}
// -- END OF FILE --
// -- END OF FILE --

View File

@ -1,11 +1,8 @@
//
// FILE: AGS02MA_readRegister.ino
// AUTHOR: Rob Tillaart, Beanow
// VERSION: 0.3.0
// PURPOSE: test application
// DATE: 2022-04-22
// URL: https://github.com/RobTillaart/AGS02MA
//
#include "AGS02MA.h"
@ -20,19 +17,18 @@ AGS02MA AGS(26);
void setup()
{
// ESP devices typically mis the first serial log lines after flashing.
// Delay somewhat to include all output.
// ESP devices typically miss the first serial log lines after flashing.
// Delay somewhat to include all output.
delay(1000);
Serial.begin(115200);
Serial.println(__FILE__);
Wire.begin();
Serial.print("AGS02MA_LIB_VERSION: ");
Serial.println(AGS02MA_LIB_VERSION);
Serial.println();
Wire.begin();
bool b = AGS.begin();
Serial.print("BEGIN:\t");
Serial.println(b);
@ -65,7 +61,7 @@ void loop()
void printRegister(uint8_t address, AGS02MA::RegisterData &reg) {
// Raw bytes first for any register.
// Raw bytes first for any register.
for (auto b : reg.data)
{
Serial.print("\t");
@ -76,7 +72,7 @@ void printRegister(uint8_t address, AGS02MA::RegisterData &reg) {
Serial.print(reg.crcValid ? "OK " : "ERR ");
Serial.print(reg.crc);
// Specific interpretations
// Specific interpretations
switch (address)
{
case 0x00:
@ -123,4 +119,4 @@ void printRegister(uint8_t address, AGS02MA::RegisterData &reg) {
}
// -- END OF FILE --
// -- END OF FILE --

View File

@ -1,11 +1,8 @@
//
// FILE: AGS02MA_setAddress.ino
// AUTHOR: Rob Tillaart
// VERSION: 0.1.0
// PURPOSE: test application
// DATE: 2021-08-13
// URL: https://github.com/RobTillaart/AGS02MA
//
#include "AGS02MA.h"
@ -16,15 +13,17 @@ AGS02MA AGS(26);
void setup()
{
// ESP devices typically miss the first serial log lines after flashing.
// Delay somewhat to include all output.
delay(1000);
Serial.begin(115200);
Serial.println(__FILE__);
Wire.begin();
Serial.print("AGS02MA_LIB_VERSION: ");
Serial.println(AGS02MA_LIB_VERSION);
Serial.println();
Wire.begin();
bool b = AGS.begin();
Serial.print("BEGIN:\t");
@ -57,4 +56,4 @@ void loop()
}
// -- END OF FILE --
// -- END OF FILE --

View File

@ -1,11 +1,8 @@
//
// FILE: AGS02MA_test.ino
// AUTHOR: Rob Tillaart
// VERSION: 0.1.0
// PURPOSE: test application
// DATE: 2021-08-12
// URL: https://github.com/RobTillaart/AGS02MA
//
#include "AGS02MA.h"
@ -16,15 +13,18 @@ AGS02MA AGS(26);
void setup()
{
// ESP devices typically miss the first serial log lines after flashing.
// Delay somewhat to include all output.
delay(1000);
Serial.begin(115200);
Serial.println(__FILE__);
Wire.begin();
Serial.print("AGS02MA_LIB_VERSION: ");
Serial.println(AGS02MA_LIB_VERSION);
Serial.println();
Wire.begin();
bool b = AGS.begin();
Serial.print("BEGIN:\t");
Serial.println(b);
@ -51,4 +51,4 @@ void loop()
}
// -- END OF FILE --
// -- END OF FILE --

View File

@ -7,10 +7,10 @@
// URL: https://github.com/RobTillaart/AGS02MA
//
// NOTE: this is a low level test for the communication / CRC
// to have this example to work,
// one need to make the _CRC8() and _buffer[]
// public in the AGS02MA.h file.
// NOTE: this is a low level test for the communication / CRC
// to have this example to work,
// one need to make the _CRC8() and _buffer[]
// public in the AGS02MA.h file.
#include "AGS02MA.h"
@ -21,15 +21,18 @@ AGS02MA AGS(26);
void setup()
{
// ESP devices typically miss the first serial log lines after flashing.
// Delay somewhat to include all output.
delay(1000);
Serial.begin(115200);
Serial.println(__FILE__);
Wire.begin();
Serial.print("AGS02MA_LIB_VERSION: ");
Serial.println(AGS02MA_LIB_VERSION);
Serial.println();
Wire.begin();
bool b = AGS.begin();
Serial.print("BEGIN:\t");
Serial.println(b);
@ -71,5 +74,5 @@ void dump(char * str)
}
// -- END OF FILE --
// -- END OF FILE --

View File

@ -0,0 +1,104 @@
//
// FILE: AGS02MA_PPB.ino
// AUTHOR: Rob Tillaart
// PURPOSE: test application
// URL: https://github.com/RobTillaart/AGS02MA
#include "AGS02MA.h"
AGS02MA AGS(26);
uint32_t rounds = 0;
void setup()
{
// ESP devices typically miss the first serial log lines after flashing.
// Delay somewhat to include all output.
delay(1000);
Serial.begin(115200);
Serial.println(__FILE__);
Serial.print("AGS02MA_LIB_VERSION: ");
Serial.println(AGS02MA_LIB_VERSION);
Serial.println();
Wire.begin();
bool b = AGS.begin();
Serial.print("BEGIN:\t");
Serial.println(b);
Serial.print("VERSION:\t");
Serial.println(AGS.getSensorVersion());
Serial.print("DATE:\t");
Serial.println(AGS.getSensorDate(), HEX);
// pre-heating improves measurement quality
// can be skipped
// Serial.println("\nWarming up (120 seconds = 24 dots)");
// while (AGS.isHeated() == false)
// {
// delay(5000);
// Serial.print(".");
// }
// Serial.println();
uint8_t version = AGS.getSensorVersion();
Serial.print("VERS:\t");
Serial.println(version);
}
void loop()
{
delay(3000);
uint8_t kind = rounds % 20;
// Switch mode every 10 and 20 rounds.
bool b;
if (kind == 0) {
b = AGS.setPPBMode();
uint8_t m = AGS.getMode();
Serial.print("MODE:\t");
Serial.print(b);
Serial.print("\t");
Serial.println(m);
} else if (kind == 10) {
b = AGS.setUGM3Mode();
uint8_t m = AGS.getMode();
Serial.print("MODE:\t");
Serial.print(b);
Serial.print("\t");
Serial.println(m);
}
// Read PPB in first half of a 20-round cycle.
if (kind < 10) {
uint32_t value = AGS.readPPB();
Serial.print("PPB:\t");
Serial.print(value);
Serial.print("\t");
Serial.print(AGS.lastStatus(), HEX);
Serial.print("\t");
Serial.print(AGS.lastError(), HEX);
Serial.println();
} else {
uint32_t value = AGS.readUGM3();
Serial.print("UGM3:\t");
Serial.print(value);
Serial.print("\t");
Serial.print(AGS.lastStatus(), HEX);
Serial.print("\t");
Serial.print(AGS.lastError(), HEX);
Serial.println();
}
rounds++;
}
// -- END OF FILE --

View File

@ -7,8 +7,8 @@
// URL: https://github.com/RobTillaart/AGS02MA
//
// just for develop scratch pad
// need to make the CRC function public in the library
// just for develop scratch pad
// need to make the CRC function public in the library
#include "AGS02MA.h"
@ -19,14 +19,18 @@ AGS02MA AGS(26);
void setup()
{
// ESP devices typically miss the first serial log lines after flashing.
// Delay somewhat to include all output.
delay(1000);
Serial.begin(115200);
Serial.println(__FILE__);
Wire.begin();
Serial.print("AGS02MA_LIB_VERSION: ");
Serial.println(AGS02MA_LIB_VERSION);
Serial.println();
Wire.begin();
bool b = AGS.begin();
Serial.print("BEGIN:\t");
Serial.println(b);
@ -78,4 +82,4 @@ void loop()
}
// -- END OF FILE --
// -- END OF FILE --

View File

@ -12,7 +12,6 @@ reset KEYWORD2
isHeated KEYWORD2
setAddress KEYWORD2
getAddress KEYWORD2

View File

@ -21,7 +21,7 @@
"type": "git",
"url": "https://github.com/RobTillaart/AGS02MA.git"
},
"version": "0.3.4",
"version": "0.4.0",
"license": "MIT",
"frameworks": "*",
"platforms": "*",

View File

@ -1,5 +1,5 @@
name=AGS02MA
version=0.3.4
version=0.4.0
author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Arduino library for AGS02MA - TVOC sensor