-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create bbn_m5atomS3_lite_ain_4_20ma.ino
- Loading branch information
Showing
1 changed file
with
21 additions
and
0 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
bbn_m5atomS3_lite_ain_4_20ma/bbn_m5atomS3_lite_ain_4_20ma.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |