It’s 4pm. I’ve spent half the day trying to get Adafruit_I2CDevice.h to be recognized. I just pasted a link into .ini, and now this:
Executing task in folder BLE_BME_680_WeMos: C:\Users\joema.platformio\penv\Scripts\platformio.exe run <
Processing wemos_d1_mini32 (platform: espressif32; board: wemos_d1_mini32; framework: arduino)
Verbose mode can be enabled via -v, --verbose
option
CONFIGURATION: Redirecting...
PLATFORM: Espressif 32 1.12.4 > WeMos D1 MINI ESP32
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
- framework-arduinoespressif32 3.10004.200129 (1.0.4)
- tool-esptoolpy 1.20600.0 (2.6.0)
- toolchain-xtensa32 2.50200.80 (5.2.0)
LDF: Library Dependency Finder → Library Dependency Finder (LDF) — PlatformIO latest documentation
LDF Modes: Finder ~ chain, Compatibility ~ soft
LibraryManager: Installing Adafruit_I2CDevice
git version 2.21.0.windows.1
Cloning into ‘C:\Users\joema\Documents\PlatformIO\Projects\BLE_BME_680_WeMos.pio\libdeps\wemos_d1_mini32_tmp_installing-yw5m6bpr-package’…
fatal: repository ‘Adafruit_BusIO/Adafruit_I2CDevice.h at master · adafruit/Adafruit_BusIO · GitHub’ not found
PlatformioException: VCS: Could not process command [‘git’, ‘clone’, ‘–recursive’, ‘–depth’, ‘1’, ‘Adafruit_BusIO/Adafruit_I2CDevice.h at master · adafruit/Adafruit_BusIO · GitHub’, ‘C:\Users\joema\Documents\PlatformIO\Projects\BLE_BME_680_WeMos\.pio\libdeps\wemos_d1_mini32\_tmp_installing-yw5m6bpr-package’]:
File “C:\Users\joema.platformio\penv\lib\site-packages\platformio\builder\main.py”, line 168:
env.SConscript(“$BUILD_SCRIPT”)
File “C:\Users\joema.platformio\packages\tool-scons\script..\engine\SCons\Script\SConscript.py”, line 597:
return _SConscript(self.fs, *files, **subst_kw)
File “C:\Users\joema.platformio\packages\tool-scons\script..\engine\SCons\Script\SConscript.py”, line 286:
exec(compile(scriptdata, scriptname, ‘exec’), call_stack[-1].globals)
File “C:\Users\joema.platformio\platforms\espressif32\builder\main.py”, line 223:
target_elf = env.BuildProgram()
File “C:\Users\joema.platformio\packages\tool-scons\script..\engine\SCons\Environment.py”, line 219:
return self.method(*nargs, **kwargs)
File “C:\Users\joema.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py”, line 62:
env.ProcessProjectDeps()
File “C:\Users\joema.platformio\packages\tool-scons\script..\engine\SCons\Environment.py”, line 219:
return self.method(*nargs, **kwargs)
File “C:\Users\joema.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py”, line 131:
project_lib_builder = env.ConfigureProjectLibBuilder()
File “C:\Users\joema.platformio\packages\tool-scons\script..\engine\SCons\Environment.py”, line 219:
return self.method(*nargs, **kwargs)
File “C:\Users\joema.platformio\penv\lib\site-packages\platformio\builder\tools\piolib.py”, line 1036:
project.install_dependencies()
File “C:\Users\joema.platformio\penv\lib\site-packages\platformio\builder\tools\piolib.py”, line 868:
lm.install(uri)
File “C:\Users\joema.platformio\penv\lib\site-packages\platformio\managers\lib.py”, line 281:
force=force,
File “C:\Users\joema.platformio\penv\lib\site-packages\platformio\managers\package.py”, line 702:
pkg_dir = self._install_from_url(name, url, requirements, track=True)
File “C:\Users\joema.platformio\penv\lib\site-packages\platformio\managers\package.py”, line 486:
assert vcs.export()
File “C:\Users\joema.platformio\penv\lib\site-packages\platformio\vcsclient.py”, line 165:
assert self.run_cmd(args)
File “C:\Users\joema.platformio\penv\lib\site-packages\platformio\vcsclient.py”, line 104:
raise PlatformioException(“VCS: Could not process command %s” % e.cmd)
==================================================================================================== [FAILED]
I see at the end it was unable to process a command. But that looks like a lot of yellow text. And it still doesn’t compile.
#include <Arduino.h>
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include "Adafruit_BME680.h"
#include <Adafruit_GFX.h> //Libraries for the OLED and BMP280
#include <Adafruit_SSD1306.h>
#include <Fonts/FreeSerif9pt7b.h>
#include <BLEDevice.h>
#include <BLEUtils.h>
#include <BLEServer.h>
// See the following for generating UUIDs:
// https://www.uuidgenerator.net/
#define SERVICE_UUID "4fafc201-1fb5-459e-8fcc-c5c9c331914b"
#define CHARACTERISTIC_UUID "beb5483e-36e1-4688-b7f5-ea07361b26a8"
#define SEALEVELPRESSURE_HPA (1013.25)
Adafruit_SSD1306 display(128, 64, &Wire, 8); //Declaring the display name (display)
Adafruit_BME680 bme; // I2C
//Adafruit_BME680 bme(BME_CS); // hardware SPI
//Adafruit_BME680 bme(BME_CS, BME_MOSI, BME_MISO, BME_SCK);
void setup()
{
Serial.begin(9600);
bme.begin();
while (!Serial)
;
Serial.println(F("BME680 async test"));
if (!bme.begin())
{
Serial.println(F("Could not find a valid BME680 sensor, check wiring!"));
while (1)
;
}
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); //Start the OLED display
display.clearDisplay();
display.display();
display.setTextColor(WHITE);
display.setTextSize(1);
display.print("SurtrTech"); //Show the name, you can remove it or replace it
display.setCursor(32, 12);
display.setTextSize(2);
display.println("Monster");
display.setCursor(32, 28);
display.println("Labs");
display.display();
delay(5000);
}
void loop()
{
BLEDevice::init("Monster Laboratories");
BLEServer *pServer = BLEDevice::createServer();
BLEService *pService = pServer->createService(SERVICE_UUID);
BLECharacteristic *pCharacteristic = pService->createCharacteristic(
CHARACTERISTIC_UUID,
BLECharacteristic::PROPERTY_READ |
BLECharacteristic::PROPERTY_WRITE);
// Set up oversampling and filter initialization
bme.setTemperatureOversampling(BME680_OS_8X);
bme.setHumidityOversampling(BME680_OS_2X);
bme.setPressureOversampling(BME680_OS_4X);
bme.setIIRFilterSize(BME680_FILTER_SIZE_3);
bme.setGasHeater(320, 150); // 320*C for 150 ms
Serial.begin(9600);
Serial.println("Starting BLE work!");
// Tell BME680 to begin measurement.
unsigned long endTime = bme.beginReading();
if (endTime == 0)
{
Serial.println(F("Failed to begin reading :("));
return;
}
Serial.print(F("Reading started at "));
Serial.print(millis());
Serial.print(F(" and will finish at "));
Serial.println(endTime);
// Obtain measurement results from BME680. Note that this operation isn't
// instantaneous even if milli() >= endTime due to I2C/SPI latency.
if (!bme.endReading())
{
Serial.println(F("Failed to complete reading :("));
return;
}
Serial.print(F("Reading completed at "));
Serial.println(millis());
pCharacteristic->setValue(bme.temperature);
pService->start();
// BLEAdvertising *pAdvertising = pServer->getAdvertising(); // this still is working for backward compatibility
BLEAdvertising *pAdvertising = BLEDevice::getAdvertising();
pAdvertising->addServiceUUID(SERVICE_UUID);
pAdvertising->setScanResponse(true);
pAdvertising->setMinPreferred(0x06); // functions that help with iPhone connections issue
pAdvertising->setMinPreferred(0x12);
BLEDevice::startAdvertising();
Serial.println("Characteristic defined! Now you can read it in your phone!");
Serial.print(F("Temperature = "));
Serial.print(bme.temperature);
Serial.println(F(" *C"));
Serial.print(F("Pressure = "));
Serial.print(bme.pressure / 100.0);
Serial.println(F(" hPa"));
Serial.print(F("Humidity = "));
Serial.print(bme.humidity);
Serial.println(F(" %"));
Serial.print(F("Gas = "));
Serial.print(bme.gas_resistance / 1000.0);
Serial.println(F(" KOhms"));
Serial.print(F("Approx. Altitude = "));
Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA));
Serial.println(F(" m"));
Serial.println();
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); //Start the OLED display
display.clearDisplay();
display.setTextColor(WHITE);
display.setTextSize(1);
display.setCursor(1, 1);
Serial.print(F("Temperature = "));
Serial.print(bme.temperature, 1);
Serial.println(F(" *C"));
Serial.print(F("Humidity = "));
Serial.print(bme.humidity, 0);
Serial.println(F(" %"));
Serial.print(F("Gas = "));
Serial.print(bme.gas_resistance / 1000.0);
Serial.println(F(" KOhms"));
Serial.print(F("Approx. Altitude = "));
Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA), 0);
Serial.println(F(" m"));
display.print("Temp: "); //Show the name, you can remove it or replace it
display.print(bme.temperature, 1); //Show the name, you can remove it or replace it
display.println(" C"); //Show the name, you can remove it or replace it
display.print("Humidity: "); //Show the name, you can remove it or replace it
display.print(bme.humidity, 0); //Show the name, you can remove it or replace it
display.println(" %"); //Show the name, you can remove it or replace it
display.print(F("Pressure: "));
display.print((bme.pressure / 100.0) * 0.03, 0);
display.println(F(" in Hg"));
display.print("Altitude: "); //Show the name, you can remove it or replace it
display.print(bme.readAltitude(SEALEVELPRESSURE_HPA), 0); //Show the name, you can remove it or replace it
display.println(" m"); //Show the name, you can remove it or replace it
display.print("Gas: "); //Show the name, you can remove it or replace it
display.print(bme.gas_resistance / 1000.0, 0); //Show the name, you can remove it or replace it
display.println(" KOhm"); //Show the name, you can remove it or replace it
//Show the name, you can remove it or replace it
display.display();
delay(5000);
}```
[env:wemos_d1_mini32]
platform = espressif32
board = wemos_d1_mini32
framework = arduino
monitor_speed = 9600
lib_deps = Adafruit_BusIO/Adafruit_I2CDevice.h at master · adafruit/Adafruit_BusIO · GitHub
I took a working BME680 program and added a working BLE advertisement.
It looks like a URL to the wrong thing. It should probably be:
lib_deps = https://github.com/adafruit/Adafruit_BusIO.git
Or just:
lib_deps = Adafruit BusIO
1 Like
… I saw that the .h file I wanted was inside BusIO.
So I should include the whole parent library?
lib_deps
is the abbreviation for library dependencies. It’s for declaring libraries that are needed to build the project.
So yes, you need to specify the library and not a single include/header file.
2 Likes