Nicla sense me stops working after some time

Arduino nicla sense me stops working after some times, it varies from couple of minutes to hours.

I am using two boards, both show the same behavior.

Using latest and updated libraries. Code is simple and the LED blink is there to monitor when board stops working.

NOTE: even simple blink sketch stops working on one of boards, the second unit is at the moment under test, will update soon.

#include "Nicla_System.h"
#include "Arduino_BHY2.h"
#include "Statistic.h"

SensorXYZ accelerometer(SENSOR_ID_ACC);
SensorXYZ gyro(SENSOR_ID_GYRO);
int accBuffer = 10000;
int accN = 0;
Statistic acc[3];

Sensor temperature(SENSOR_ID_TEMP);
Sensor gas(SENSOR_ID_GAS);
Sensor pressure(SENSOR_ID_BARO);

SensorBSEC bsec(uint8_t(171)); //https://forum.arduino.cc/t/nicla-sense-me-bsec-sensor-only-returns-0/939600
float updateTime = 5000;
bool ledState = true;
void setup() {
 
  Serial1.begin(115200);
  nicla::begin();
  nicla::leds.begin();

  BHY2.begin();
  accelerometer.begin();
  gyro.begin();

  temperature.begin();
  gas.begin();
  pressure.begin();
  bsec.begin();
}

void loop() {
  static auto lastCheck = millis();
  accLoop();
 
  if (millis() - lastCheck >= updateTime) {
    led();
    lastCheck = millis();
    
    Serial.println(String("env") + "," + String(int(temperature.value());
  }
}

void accLoop() {
  BHY2.update();
  acc[0].add(accelerometer.x());
  accN++;
  if (accN > accBuffer) {
    accN = 0;
    Serial1.println( String(String("acc") + "," +
                            String(acc[0].average()));
    acc[0].clear();
  }
}

void led() {
  ledState = !ledState;
  if (ledState) {
    nicla::leds.setColor(cyan);
  } else {
    nicla::leds.setColor(magenta);
  }

}

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.