Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arduino nano every hangs after a few minutes #34

Open
marcosdepo opened this issue Dec 7, 2022 · 1 comment
Open

Arduino nano every hangs after a few minutes #34

marcosdepo opened this issue Dec 7, 2022 · 1 comment

Comments

@marcosdepo
Copy link

Humidity and Temperature data is received correctly by Serial, but after a random number of minutes (2min to 10min) arduino hangs, and stops sending data.
I added the code the function to toggle the pin 13 led each time it sends data, it hangs too.

  • Arduino board: Arduino Nano Every

  • Arduino IDE version : 1.8.13

  • Code

#include <Arduino.h>
#include <Wire.h>
#include "Adafruit_SHT31.h"
 
Adafruit_SHT31 sht31 = Adafruit_SHT31();
const int led = 13;
 
void setup() 
{
  delay(100);
  pinMode(led, OUTPUT);
  Serial.begin(9600);
  if (! sht31.begin(0x44)) 
  {
    Serial.println("Couldn't find SHT31");
    while (1) delay(1);
  }
}
 
void loop() 
{
  float t = sht31.readTemperature();
  float h = sht31.readHumidity();
 
  if (! isnan(t)) 
  {
    Serial.print("Temp *C = "); Serial.println(t);
  } 
  else 
  { 
    Serial.println("Failed to read temperature");
  }
 
  if (! isnan(h)) 
  {
    Serial.print("Hum. % = "); Serial.println(h);
  } 
  else 
  { 
    Serial.println("Failed to read humidity");
  }
  Serial.println();
  digitalWrite(led, !digitalRead(led));
  delay(1000);
}
@IotMecatronica
Copy link

hola amigo, prueba quitando el delay o posiblemente los dos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants