Skip to content

Commit

Permalink
Create bbn_m5atomS3_lite_env3.ino
Browse files Browse the repository at this point in the history
  • Loading branch information
mgrouch authored Oct 6, 2024
1 parent 211eb9e commit 54be24b
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions bbn_m5atomS3_lite_env3/bbn_m5atomS3_lite_env3.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#include <M5AtomS3.h>
#include <M5Unified.h>
#include <Arduino.h>
#include <M5UnitENV.h>
#include <Wire.h>
#include "NmeaXDR.h"

SHT3X sht3x;
QMP6988 qmp;

void setup() {
auto cfg = M5.config();
AtomS3.begin(cfg);
Wire.begin();
Serial.begin(4800);

if (!qmp.begin(&Wire, QMP6988_SLAVE_ADDRESS_L, G2, G1, 100000U)) {
Serial.println("Couldn't find QMP6988");
while (1) delay(1);
}

if (!sht3x.begin(&Wire, SHT3X_I2C_ADDR, G2, G1, 100000U)) {
Serial.println("Couldn't find SHT3X");
while (1) delay(1);
}
}

void loop() {
if (sht3x.update()) {
gen_nmea0183_xdr("$BBXDR,H,%.2f,P,HUMI", sht3x.humidity); // %
//gen_nmea0183_xdr("$BBXDR,C,%.2f,C,TEMP", sht3x.cTemp); // C
}

if (qmp.update()) {
gen_nmea0183_xdr("$BBXDR,C,%.2f,C,TEMP", qmp.cTemp); // C
gen_nmea0183_xdr("$BBXDR,P,%.2f,P,PRES", qmp.pressure); // Pa
}
delay(1000);
}

0 comments on commit 54be24b

Please sign in to comment.