From 24102a869e5ec241d95e87f30f00caef70f08cee Mon Sep 17 00:00:00 2001
From: ulyssis
Date: Wed, 9 Oct 2024 16:33:18 +0200
Subject: [PATCH 1/2] define the GPIOs designated for I2C communication for
ESP32, the define should be adapted according to the specific controller in
use
---
examples/01_Basic/ENS160/ENS160.ino | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/examples/01_Basic/ENS160/ENS160.ino b/examples/01_Basic/ENS160/ENS160.ino
index 86c8069..d44a52d 100644
--- a/examples/01_Basic/ENS160/ENS160.ino
+++ b/examples/01_Basic/ENS160/ENS160.ino
@@ -11,6 +11,8 @@ I2cInterface i2c;
#define USE_INTERRUPT
#define INTN 2
+#define I2C_SDA 21
+#define I2C_SCL 22
ENS160 ens160;
@@ -19,7 +21,7 @@ void setup()
Serial.begin(9600);
ens160.enableDebugging(Serial);
- Wire.begin();
+ Wire.begin(I2C_SDA,I2C_SCL,0);
i2c.begin(Wire, I2C_ADDRESS);
Serial.println("begin..");
@@ -69,4 +71,4 @@ void loop()
}
-}
\ No newline at end of file
+}
From 7291153501045516a2ee9378767d082944957108 Mon Sep 17 00:00:00 2001
From: ulyssis
Date: Wed, 9 Oct 2024 16:48:58 +0200
Subject: [PATCH 2/2] improve the README regardign the assignment of GPIOs for
I2C on ESP32
---
README.md | 1 +
examples/01_Basic/ENS160/ENS160.ino | 1 +
2 files changed, 2 insertions(+)
diff --git a/README.md b/README.md
index a0d523a..62098d4 100644
--- a/README.md
+++ b/README.md
@@ -63,6 +63,7 @@ To build an example sketch
- (Re)start Arduino.
- Open File > Example > Examples from Custom Libraries > ScioSense_ENS16x > 01_Basic (or any other of the provided examples you wish to run)
- Make sure Tools > Board lists the correct board.
+ - Make sure the GPIOs for I2C on the ESP32 (I2C_SDA and I2C_SCL) in use are correct.
- Select Sketch > Verify/Compile.
## Acknowledgements
diff --git a/examples/01_Basic/ENS160/ENS160.ino b/examples/01_Basic/ENS160/ENS160.ino
index d44a52d..cee2648 100644
--- a/examples/01_Basic/ENS160/ENS160.ino
+++ b/examples/01_Basic/ENS160/ENS160.ino
@@ -1,3 +1,4 @@
+// wanring: before usage please make sure the GPIOs for I2C on the ESP32 (I2C_SDA and I2C_SCL) in use are correct.
#include
#include
#include