ESP8266莫名重啓或者死機問題

多半是內存使用不當數組

   1. 若是你要用很大長度的數組,那麼能夠換用更小的數據類型。好比,int值要佔用兩個字節,你能夠用byte(只佔用一個字節)代替;
    2. esp8266有時會莫明重啓,大部分狀況是變量設置不當,雖然編譯經過了,但變量在調用過程當中出現異常,形成函數運行時變量內存溢出,寫複雜代碼時,
       最好是不要一次寫了不少再編譯調試。
    3. 儘可能少用全局變量,全局變量在整個生命週期都會存在,很是耗內存,內存不足也是esp8266不穩定因素之一。長串的變量儘可能做長度控制,設定邊界,若是你的項目很大,必定要規劃好變量。
    4. 儘可能不要在loop循環中定義變量,儘可能只放函數封裝,貌似這裏定義了變量不會像函數中的局變量用完就回收。函數

  5.The ESP8266 requires a good power supply as it produces current spikes of up to 170 mA during transmit (typical average consumption is around 70 mA when WiFi is on). Check the power supply first, if your ESP runs unstable, has a bad throughput, or reboots from time to time. A large capacitor between Vdd and Gnd can help if you experience problems here. It has been reported that there are sometimes severe throughput problems with the small power supply/serial-to-usb boards for the ESP01. These boards use an XC6206 voltage regulator labeled "662K". Maybe you try an alternative power supply first, if you experience these kind of problems.oop

相關文章
相關標籤/搜索