Keep freezing V3.2 when uploading IDE sketch for two I2C sensors

  • V3 is loaded with Meshtastic firmware
  • Not connected to any other devices, e.g., to iPhone via BLE
  • Put the V3 into boot load before compiling and uploading
  • Relevant Heltec board and library(ies) added to IDE
  • GPIO 41 and 42 used for SDA and SCL, respectively
  • Espressif ESP32 library removed
  • Both sensors are supported by Meshtastic firmware
  • Sketch below

Upload is successful but board freezes up. Amber light blinks and/or becomes completely dark. Meshtastic CLI Python tool unable to connect. Have to use esptool to erase and reflash.

One comment on the internet says do not release PRG/Boot button until you see “Connecting…” on Arduino monitor. Necessary?

#include <dummy.h>

#include <Wire.h>

#include <Adafruit_BME280.h>

#include <Adafruit_INA219.h>

#define SDA_PIN 41

#define SCL_PIN 42

Adafruit_BME280 bme;

Adafruit_INA219 ina219;

void setup() {

Serial.begin(115200);

Wire.begin(SDA_PIN, SCL_PIN);

// BME280 Init

if (!bme.begin(0x76)) {

Serial.println("BME280 not found!");

while (1);

}

// INA219 Init

if (!ina219.begin()) {

Serial.println("INA219 not found!");

while (1);

}

Serial.println(“Sensors initialized.”);

}

void loop() {

float temp = bme.readTemperature();

float hum = bme.readHumidity();

float pres = bme.readPressure() / 100.0F;

float volt = ina219.getBusVoltage_V();

float curr = ina219.getCurrent_mA();

Serial.printf(“Temp: %.2f C, Humidity: %.2f %%, Pressure: %.2f hPa\n”, temp, hum, pres);

Serial.printf(“Voltage: %.2f V, Current: %.2f mA\n\n”, volt, curr);

delay(1000);

}