Open Gadgetoid opened 3 years ago
A C++ library has been kindly contributed by Simon, needs reviewing & testing before handoff to Python bindings - https://github.com/pimoroni/pimoroni-pico/pull/93
Edit: Update: Merged!
I've tested and verified that the SGP30 contrib library outputs some readings. They differ when I breathe on it, and getting it set up and working with Pico Explorer was as simple as changing the pins supplied to the constructor:
diff --git a/examples/breakout_sgp30/demo.cpp b/examples/breakout_sgp30/demo.cpp
index 41ce235..574e051 100644
--- a/examples/breakout_sgp30/demo.cpp
+++ b/examples/breakout_sgp30/demo.cpp
@@ -8,14 +8,21 @@
#include <stdio.h>
#include <string.h>
#include "pico/stdlib.h"
+#include "hardware/i2c.h"
#include "breakout_sgp30.hpp"
using namespace pimoroni;
-BreakoutSGP30 sgp30;
+#define I2C_BUS i2c0
+#define I2C_SDA 20
+#define I2C_SCL 21
+
+BreakoutSGP30 sgp30(i2c0, 20, 21);
int main() {
+ setup_default_uart();
+
uint8_t prd;
uint16_t eCO2, TVOC;
uint16_t raweCO2, rawTVOC;
This does raise the question- how should we go about indicating the difference between Breakout Garden and Pico Explorer i2c pins in examples? I've definitely tripped up more than once due to this.
C++ and MicroPython support merged: https://github.com/pimoroni/pimoroni-pico/pull/136
breakouts.config
- https://github.com/pimoroni/breakout-garden/blob/master/breakouts.config