如何将WifiManager与Adafruit IO配合使用



我正在使用Adafruit IO,并试图将其与WifiManager结合在一起,这样我就不必硬编码wifi凭据,但当我将wifi_sid和wifi_pass设置为null并依靠wifimager进行连接时,我会遇到此错误。当我设置凭据时,一切都很顺利。如何将adafruit IO与wifimanger一起使用?

Connecting to Adafruit IOGuru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.
20:26:54.512 -> Core 1 register dump:
20:26:54.512 -> PC      : 0x400e1c82  PS      : 0x00060c30  A0      : 0x800e12f1  A1      : 0x3ffb1d30  
20:26:54.512 -> A2      : 0x3ffc17a8  A3      : 0x3f400196  A4      : 0xfffffc7f  A5      : 0x00002180  
20:26:54.512 -> A6      : 0x00002000  A7      : 0x3ffc1ae4  A8      : 0x00000000  A9      : 0x3ffb1d10  
20:26:54.560 -> A10     : 0x00000019  A11     : 0x3f400196  A12     : 0x00000019  A13     : 0x0000ff00  
20:26:54.560 -> A14     : 0x00ff0000  A15     : 0xff000000  SAR     : 0x0000001c  EXCCAUSE: 0x0000001c  
20:26:54.560 -> EXCVADDR: 0x00000000  LBEG    : 0x400014fd  LEND    : 0x4000150d  LCOUNT  : 0xfffffff9  
20:26:54.560 -> 
20:26:54.560 -> ELF file SHA256: 0000000000000000
20:26:54.560 -> 
20:26:54.560 -> Backtrace: 0x400e1c82:0x3ffb1d30 0x400e12ee:0x3ffb1d50 0x400d1615:0x3ffb1d70 0x400e5156:0x3ffb1fb0 0x4008ab7a:0x3ffb1fd0
20:26:54.560 -> 
20:26:54.560 -> Rebooting...
20:26:54.606 -> ets Jun  8 2016 00:22:57

Arduino代码

#include <WiFiManager.h>
#include "config.h"
AdafruitIO_Feed *lamp = io.feed("lamp");
void setup() {
Serial.begin(115200);
Serial.println("Booting Up");

//WIFI STUFF
bool res;

WiFiManager wifiManager;
res = wifiManager.autoConnect("lamp");
if(!res) {
Serial.println("Failed to connect");
// ESP.restart();
} 
else {
//if you get here you have connected to the WiFi    
Serial.println("connected...yeey :)");
}
//END WIFI STUFF
//start connecting to Adafruit IO
Serial.print("Connecting to Adafruit IO");
io.connect();
}

config.h

//get this info from the "My Key" section of the Adafruit IO website
#define IO_USERNAME  "XXX"
#define IO_KEY       "XXX"
// ***************************IGNORE ALL BELOW THIS**********************************
#include "AdafruitIO_WiFi.h"
AdafruitIO_WiFi io(IO_USERNAME, IO_KEY, NULL, NULL);

使用当前或相对较新版本的AdafuitIO库,您可以这样调用以避免Adafuit库连接到WiFi。。。

AdafruitIO_WiFi io(IO_USERNAME, IO_KEY, "", "");

相关内容

  • 没有找到相关文章

最新更新