Hi,
I am trying to control a NeoPixel LED-Ring with an ESP32 controller.
But the initialisation somehow doesn't work.
Here the setup section from my sketch:
#include <WiFi.h>
#include <PubSubClient.h>
#include <Adafruit_NeoPixel.h>
const char ssid[] = "xxxx";
const char WiFipassword[] = "xxxxx";
const char mqtt_server[] = "10.0.1.10";
int interval;
long lastTime;
#define DELAYVAL 500 // Time (in milliseconds) to pause between pixels
// Setup WiFi connection and MQTT client.
WiFiClient mqttClient;
PubSubClient MQTTclient(mqttClient);
// Define the NeoPixel strip:
#define PIN 6 // Which pin on the Arduino is connected to the NeoPixels?
#define NUMPIXELS 12 // How many NeoPixels are attached to the Arduino? // Popular NeoPixel ring size
// Declare our NeoPixel strip object:
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
void setup() {
Serial.begin(115200);
delay(10);
// Connect to WiFi network
Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, WiFipassword);
while (WiFi.status() != WL_CONNECTED) {
delay(100);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected with IP address:");
Serial.println(WiFi.localIP());
// Setup mqtt
MQTTclient.setServer(mqtt_server, 1883);
MQTTclient.setCallback(callback);
Serial.println("Start initialising NeoPixels");
// setup NeoPixel
pixels.begin(); // INITIALIZE NeoPixels
Serial.println("Step 1 done");
interval = 150;
Serial.println("Step 2 done");
randomSeed(analogRead(0));
Serial.println("SETUP done");
}
In the serial monitor I can see the setup runs through to the randomSeed and then it crashes. But indeed it is the pixels.begin() command which causes the issue as it runs fine when I comment this line out.
Here what I get in the serial monitor:
15:15:25.177 -> WiFi connected with IP address:
15:15:25.177 -> 10.0.1.98
15:15:25.177 -> Start initialising NeoPixels
15:15:25.177 -> Step 1 done
15:15:25.177 -> Step 2 done
15:15:25.177 -> Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
15:15:25.177 -> Core 1 register dump:
15:15:25.177 -> PC : 0x400813b7 PS : 0x00060430 A0 : 0x80081177 A1 : 0x3ffb1f10
15:15:25.177 -> A2 : 0x00000000 A3 : 0x000000c0 A4 : 0x3fdff7fd A5 : 0x0000ff00
15:15:25.177 -> A6 : 0x00ff0000 A7 : 0xff000000 A8 : 0x3f409458 A9 : 0x000000c0
15:15:25.215 -> A10 : 0xffffffff A11 : 0x00000044 A12 : 0x00000002 A13 : 0x0000ff00
15:15:25.215 -> A14 : 0x00ff0000 A15 : 0xff000000 SAR : 0x0000001f EXCCAUSE: 0x0000001c
15:15:25.215 -> EXCVADDR: 0xffffffff LBEG : 0x400014fd LEND : 0x4000150d LCOUNT : 0xffffffff
15:15:25.215 ->
15:15:25.215 -> Backtrace: 0x400813b7:0x3ffb1f10 0x40081174:0x3ffb1f30 0x400812ed:0x3ffb1f50 0x400d0edb:0x3ffb1f70 0x400d3627:0x3ffb1fb0 0x40088f49:0x3ffb1fd0
15:15:25.253 ->
15:15:25.253 -> Rebooting...
15:15:25.253 -> ets Jun 8 2016 00:22:57
15:15:25.253 ->
15:15:25.253 -> rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
15:15:25.253 -> configsip: 0, SPIWP:0xee
15:15:25.253 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
15:15:25.253 -> mode:DIO, clock div:1
15:15:25.253 -> load:0x3fff0018,len:4
15:15:25.253 -> load:0x3fff001c,len:1216
15:15:25.253 -> ho 0 tail 12 room 4
15:15:25.253 -> load:0x40078000,len:9720
15:15:25.253 -> ho 0 tail 12 room 4
15:15:25.253 -> load:0x40080400,len:6352
15:15:25.290 -> entry 0x400806b8
15:15:25.512 ->
15:15:25.512 ->
15:15:25.512 -> Connecting to Home_less
Not sure what's the is here?
Thanks for any help!