mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
74 lines
1.3 KiB
C++
74 lines
1.3 KiB
C++
//
|
|
// 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"
|
|
|
|
|
|
AGS02MA AGS(26);
|
|
|
|
|
|
void setup()
|
|
{
|
|
Serial.begin(115200);
|
|
Serial.println(__FILE__);
|
|
|
|
Wire.begin();
|
|
|
|
Serial.print("AGS02MA_LIB_VERSION: ");
|
|
Serial.println(AGS02MA_LIB_VERSION);
|
|
Serial.println();
|
|
|
|
bool b = AGS.begin();
|
|
Serial.print("BEGIN:\t");
|
|
Serial.println(b);
|
|
|
|
Serial.print("VERSION:\t");
|
|
Serial.println(AGS.getSensorVersion());
|
|
|
|
// 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();
|
|
|
|
b = AGS.setPPBMode();
|
|
uint8_t m = AGS.getMode();
|
|
Serial.print("MODE:\t");
|
|
Serial.print(b);
|
|
Serial.print("\t");
|
|
Serial.println(m);
|
|
|
|
uint8_t version = AGS.getSensorVersion();
|
|
Serial.print("VERS:\t");
|
|
Serial.println(version);
|
|
}
|
|
|
|
|
|
void loop()
|
|
{
|
|
delay(3000);
|
|
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();
|
|
|
|
}
|
|
|
|
|
|
// -- END OF FILE --
|