Repository navigation
Closed
Description
My board is resetting.
My sketch causes frequent resets: rst cause:2, boot mode:(3,6)
At first I thought it was Ram or Power issues but I have ruled them out.
Code works with Teensy
Apologies if it is not an issue with the library.
include "FastLED.h"
#define NUM_LEDS 8 //number of leds in strip length on one side
#define DATA_PIN D2//7 = second hardware spi data
#define CLOCK_PIN D3//14 = second hardware spi clock
#define COLOR_ORDER BGR
CRGB leds[NUM_LEDS];
int numberOfSlices = 8;
void PoiSonic(unsigned long time, const unsigned int array[]){
unsigned long currentTime = millis();
while (millis()< currentTime + (time)) {
int f= numberOfSlices;
int z; //a counter
int j=NUM_LEDS;
for (int x=0;x<f;x++){
for(z=NUM_LEDS;z>0;z--){
leds[z-1]=array[x+((j-z)*f)];
}
FastLED.show();
delayMicroseconds(1200); //may need to increase / decrease depending on spin rate
}
delayMicroseconds(1000); //may need to increase / decrease depending on spin rate
}
}
void setup() {
delay(200);
FastLED.addLeds<APA102, DATA_PIN, CLOCK_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);;
FastLED.clear();
FastLED.show();
}
const unsigned int array1[] = { 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF,0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF, 0x0000FF};
void loop() {
PoiSonic(20000,array1);
}
Metadata
Metadata
Assignees
Labels
No labels
Activity
focalintent commentedon Oct 26, 2016
You can't go for 20 seconds without exiting the loop function on the esp8266 - that will likely cause the watchdog timer to reset, also - how many items are in array1 - you'll want to make sure that you aren't accessing outside of array1 - reading from an invalid address is also something that might cause a reset on the esp8266.
gavspav commentedon Oct 26, 2016
Ah ok. Thanks - I threw a delay(0) in there and the resets stopped.
Sorry for the false flag.