Skip to content

Commit

Permalink
Create bbn_m5atomS3_lite_ain_4_20ma.ino
Browse files Browse the repository at this point in the history
  • Loading branch information
mgrouch authored Oct 27, 2024
1 parent 8f04e0f commit 9120aed
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions bbn_m5atomS3_lite_ain_4_20ma/bbn_m5atomS3_lite_ain_4_20ma.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include <M5AtomS3.h>
#include "MODULE_4_20MA.h"

MODULE_4_20MA meter;

void show_current_value(void) {
Serial.printf("Current:%.2fmA\n", (float)(meter.getCurrentValue(0)) / 100.0);
}

void setup() {
auto cfg = M5.config();
AtomS3.begin(cfg);
Wire.begin();
Serial.begin(4800);
while (!(meter.begin(&Wire, MODULE_4_20MA_ADDR, G2, G1, 100000UL))) ;
}

void loop() {
show_current_value();
delay(1000);
}

0 comments on commit 9120aed

Please sign in to comment.