Skip to content

Wemos D1 R2 resetting #362

Closed
Closed

Description

@gavspav

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);

 }

Activity

  1. focalintent commented on Oct 26, 2016

    @focalintent
    Contributor

    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.

  2. gavspav commented on Oct 26, 2016

    @gavspav
    Author

    Ah ok. Thanks - I threw a delay(0) in there and the resets stopped.
    Sorry for the false flag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions