Skip to content

A patch to the ino file, where the GPIOs for I2C_SDA and I2C_SCL are defined, so that the scratch can be directly used. #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions examples/01_Basic/ENS160/ENS160.ino
Original file line number Diff line number Diff line change
@@ -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 <Arduino.h>
#include <Wire.h>
#include <ScioSense_ENS16x.h>
Expand All @@ -11,6 +12,8 @@ I2cInterface i2c;

#define USE_INTERRUPT
#define INTN 2
#define I2C_SDA 21
#define I2C_SCL 22

ENS160 ens160;

Expand All @@ -19,7 +22,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..");
Expand Down Expand Up @@ -69,4 +72,4 @@ void loop()


}
}
}