Ошибка мягкого сброса WDT ESP8266

У меня есть проект с EP8266, использующий веб-сервер для управления некоторыми светодиодами и считывания датчика BMP180. Я получаю сообщение об ошибке Soft WDT reset. Мой код работал нормально, но по какой-то причине, когда я пытался использовать батарею на 9 В, этого не произошло. Я не знаю что делать. Надеюсь, вы поможете мне понять. Все советы будут полезны.

Заранее спасибо за помощь.

#include "NeoPixelBus.h" // Library to control Pixel Stick
#include "ESP8266WiFi.h" // WiFi Library
#include <Wire.h>
#include <Adafruit_BMP085.h>

Adafruit_BMP085 bmp;
#define PixelCount 16 // Number of LEDS on stick
#define PixelPin 2 // NodeMCU pin 2 (RX) connected to Digital In of Pixel 
Stick

const char* ssid = "Louise"; // Name of WiFi Network
const char* password = "xxxx"; // Password of WiFi Network
double referencePressure;
int firstrun = 0; // Check if system was just powered on
int buttonpressed = 5; // To hold which button was pressed on Web Page

// Initialize Library
NeoPixelBus<NeoGrbFeature, Neo800KbpsMethod> strip(PixelCount, PixelPin);
RgbColor black(0);
// Define Arrays for colors

long switchled01[] = {
  0x19257B, 0x7B7A19, 0x19257B, 0x7B7A19, 0x19257B, 0x7B7A19, 0x19257B,
  0x7B7A19
};

WiFiServer server(80); // Define Web Server Port

void setup() {
  Serial.begin(115200);
  delay(10);
  if (!bmp.begin()) {
    Serial.println("Could not find BMP180 or BMP085 sensor at 0x77");
    while (1) {}
  }
  strip.Begin(); // Init of Pixel Stick
  strip.Show(); // Clears any lit up LEDS
  // Connect to WiFi network
  Serial.print("Connecting to ");
  Serial.println(ssid);
  WiFi.begin(ssid, password);
  // Wait until connected to WiFi
  while (WiFi.status() != WL_CONNECTED) {
    delay(250);
    Serial.print(".");
  }
  // Confirmation that WiFi is connected
  Serial.println("");
  Serial.println("WiFi connected");
  // Start the Web Server
  server.begin();
  Serial.println("Web Server Started");
  // Display IP address
  Serial.print("You can connect to the Server here: ");
  Serial.print("http://");
  Serial.print(WiFi.localIP());
  Serial.println();
  Serial.println();
}

void loop() {
  // Check if someone is connected
  WiFiClient client = server.available();
  if (!client) {
    return;
  }
  // Read which button was pressed on the Web Page
  String request = client.readStringUntil('\r');
  // Light up LEDS based on the button pressed
  if (request.indexOf("/OFF=1") != -1) {
    for (int led = 0; led < 8; led++) {
      strip.SetPixelColor(0, black);
      strip.SetPixelColor(0, black);
      strip.SetPixelColor(1, black);
      strip.SetPixelColor(2, black);
      strip.SetPixelColor(3, black);
      strip.SetPixelColor(4, black);
      strip.SetPixelColor(5, black);
      strip.SetPixelColor(6, black);
      strip.SetPixelColor(7, black);
      strip.Show();
    }
    strip.Show();
    buttonpressed = LOW;
    firstrun = 1;
  }
  if (request.indexOf("/ON=1") != -1) {
    for (int led = 0; led < 8; led++) {
      strip.SetPixelColor(led, HtmlColor(switchled01[led]));
    }
    strip.Show();
    buttonpressed = HIGH;
    firstrun = 1;
  }
  // Display the HTML web page
  client.println("<head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">");
  client.println("<link rel=\"icon\" href=\"data:,\">");
  // CSS to style the on/off buttons
  // Feel free to change the background-color and font-size attributes to fit your preferences
  client.println("<style>html { font-family: Helvetica; display: inline-block; margin: 0px auto; text-align: center;}");
  client.println("text-decoration: none; font-size: 30px; margin: 2px; cursor: pointer;}");
  // Web Page Heading
  client.println("<body><h1>Sistema de LEDS off babby room</h1>");
  // Create Web Page
  client.println("HTTP/1.1 200 OK"); // HTML Header
  client.println("Content-Type: text/html");
  client.println("");
  client.println("<!DOCTYPE HTML>");
  client.println("<meta charset=ISO-8859-15>");
  client.println("<html>"); // Start of HTML
  client.println("<style>");
  client.println("body {background-color: #ACAEAD;}"); // Set Background Color
  client.println("Button {background-color: #195B6A; border: none; color: white; padding: 16px 40px;"); // Set Background Color
  client.println("</style>");
  client.println("<h1>LEDS shelf</h1>");
  client.println("<h4>Liga sistema de LEDS nas prateleiras de nuvem e ativa sensor de temperatura</h4>");
  if (buttonpressed == LOW) {
    client.print("OFF");
  }
  if (buttonpressed == HIGH) {
    client.print("ON");
  }
  client.println("<br><br>");
  client.println("<a href=\"/ON=1\"\"><button class=\"/Butme\">Ligar</button></a><br />");
  client.println("<br><br>");
  client.println("<a href=\"/OFF=1\"\"><button class=\"/Butme\">Desligar</button></a>");
  client.println("<br><br>");
  client.println("<h1>Dados Metereol&oacute;gicos</h1>"); client.println("<br><br>");
  client.println("<img border=\"0\" src=\"https://www.dropbox.com/s/11n8oio8f6yady9/ESPWheater.png?dl=0\" /><br />");
  client.println("<br><br>");
  client.println("<h3>Temperatura agora = ");
  client.println(bmp.readTemperature());
  client.println("&deg;C</h3><h3>Press&atilde;o do Ar = ");
  client.println(bmp.readPressure());
  client.println("%</h3><h3>Altitude = ");
  client.println(bmp.readAltitude());
  client.println(" Metros</h3>");
  client.println("</html>");
  delay(10);
}

person Leogreen    schedule 12.04.2018    source источник
comment
Как вы понижаете напряжение с 9 до 3,3?   -  person nPn    schedule 13.04.2018
comment
Ваш код не имеет ничего общего с вашим вероятно. Вроде бы полностью аппаратная проблема.   -  person dda    schedule 13.04.2018


Ответы (1)


Если он перестал работать при смене блока питания, скорее всего, это вызвано блоком питания. Подумайте об использовании ячеек 18650 и чего-то вроде TP4056, который поможет вам как регулировать выходное напряжение, так и заряжать элемент.

person churruscat    schedule 13.04.2018