actually not “kill”, but make it unusable until it is repaired with some CLI commands.
can someone please tell me what is wrong with that code?
edit: corrected code:
#include "Particle.h"
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
// Set up BME
#define BME_ADDRESS 0x76 // Use i2c_scanner to determine address
// define the pin for the led. (D7 is the PIN that is coupled with the on-board LED)
void setup();
void loop();
const int ledPin = D7;
// define the pin for the button
const int buttonPin = D5;
// the state of the push button.
int buttonState = HIGH; //not pressed
int start_when_button_was_pressed = 0;
Adafruit_BME280 bme;
float temperature = 0;
float humidity = 0;
int button_pressed_time = 0;
// setup() runs once, when the device is first turned on.
void setup() {
bme.begin(BME_ADDRESS);
// Start I2C
Wire.begin();
// set the pin mode for the button
pinMode(buttonPin, INPUT_PULLUP);
// set the pin mode for the LED
pinMode(ledPin, OUTPUT);
Particle.variable("temperature", String(temperature));
Particle.variable("humidity", String(humidity));
Particle.variable("button_pressed_time", button_pressed_time);
}
void loop() {
buttonState = digitalRead(buttonPin);
if(buttonState == HIGH) {
button_pressed_time = 0;
} else {
// turn the led on so the user can see that *something* happens
digitalWrite(ledPin, HIGH);
button_pressed_time += millis();
}
temperature = bme.readTemperature();
humidity = bme.readHumidity();
delay(1000);
}
edit: guess i found the problem. bme.begin() is missing. will check that and update the post
edit #2: that was the problem… bme.begin(BME_ADDRESS) fixed it