Arduino 软WDT复位错误ESP8266

Arduino 软WDT复位错误ESP8266,arduino,esp8266,arduino-ide,arduino-esp8266,Arduino,Esp8266,Arduino Ide,Arduino Esp8266,我有一个EP8266项目,使用web服务器控制一些LED并读取BMP180传感器。我收到一个名为Soft WDT reset的错误。我的代码工作正常,但由于某种原因,现在当我尝试使用9V电池时,却无法正常工作。我不知道该怎么办。我希望你能帮助我理解。所有提示都会有帮助 提前谢谢你的帮助 #include "NeoPixelBus.h" // Library to control Pixel Stick #include "ESP8266WiFi.h" // WiFi Library #inclu

我有一个EP8266项目,使用web服务器控制一些LED并读取BMP180传感器。我收到一个名为
Soft WDT reset
的错误。我的代码工作正常,但由于某种原因,现在当我尝试使用9V电池时,却无法正常工作。我不知道该怎么办。我希望你能帮助我理解。所有提示都会有帮助

提前谢谢你的帮助

#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);
}
#包括“NeoPixelBus.h”//Library以控制像素棒
#包括“ESP8266WiFi.h”//WiFi库
#包括
#包括“
”; client.println(“

”); 客户。println(“”); client.println(“

”); client.println(“Dados Metereoló;gicos”);client.println(“

”); client.println(“
”); client.println(“

”); client.println(“Temperatura agora=”); client.println(bmp.readTemperature()); client.println(“°;CPressã;o do Ar=”); client.println(bmp.readPressure()); client.println(“%althip=”); client.println(bmp.readAltitude()); 客户:println(“Metros”); 客户。println(“”); 延迟(10); }
< /代码> < P>当电源发生变化时,电源停止工作,这可能是电源造成的。请考虑使用18650个电池和一些类似于TP4056的电池,这将有助于调节输出电压和充电电池。

< P>如果电源更换时停止工作,很可能是电源造成的。er使用18650个电池和类似TP4056的东西,这将帮助您调节输出电压和电池充电。

您如何将电压从9v调节到3.3v?您的代码可能与电压无关。这似乎完全是硬件问题。您如何将电压从9v调节到3.3v?您的代码与电压无关可能吧。这似乎完全是硬件问题。