Double_G

Untitled

Sep 12th, 2021
681
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.88 KB | None | 0 0
  1. Guru Meditation Error: Core  1 panic'ed (Interrupt wdt timeout on CPU1)
  2.  
  3. Legyártottam a kód inkriminált részét. Pont ugyan azt teszi amit a sajátom.
  4. Nem akartam széjjel tutujgatni a sajátomat.
  5.  
  6. #include <FastLED.h>
  7.  
  8. #define LED_PIN     2
  9. #define NUM_LEDS    60
  10. #define BRIGHTNESS  255
  11. #define LED_TYPE    WS2812B
  12. #define COLOR_ORDER GRB
  13. CRGB leds[NUM_LEDS];
  14.  
  15. void IRAM_ATTR onTimer(){   //körbe forgatja a ledek tartalmát
  16.            
  17.             leds[59] = leds[40];
  18.            leds[39] = leds[20];
  19.            leds[19] = leds[0];
  20.                      
  21.            
  22.        for(int dot = 0; dot < 20; dot++) {
  23.            leds[dot+40] = leds[dot+41];
  24.            leds[dot+20] = leds[dot+21];
  25.            leds[dot] = leds[dot+1];
  26.             FastLED.show();     //megjeleníti.
  27.        
  28. }
  29. }
  30.  
  31. void setup() {
  32.  hw_timer_t * timer = NULL;
  33.  
  34.  // put your setup code here, to run once:
  35.  /* Use 1st timer of 4 */
  36.  /* 1 tick take 1/(80MHZ/80) = 1us so we set divider 80 and count up */
  37.  timer = timerBegin(0, 80, true);
  38.  
  39.  /* Attach onTimer function to our timer */
  40.  timerAttachInterrupt(timer, &onTimer, true);
  41.  
  42.  /* Set alarm to call onTimer function every second 1 tick is 1us
  43.  => 1 second is 1000000us */
  44.  /* Repeat the alarm (third parameter) */
  45.  timerAlarmWrite(timer, 5000, true);   //100Hz
  46.  
  47.  /* Start an alarm */
  48.  timerAlarmEnable(timer);
  49.  
  50.  FastLED.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
  51.  FastLED.setBrightness(  BRIGHTNESS );
  52.  
  53. for (int dot=0;dot <= 10; dot ++) { //sárga és fekete szineket állít be.
  54.      leds[dot] = CRGB::Orange;
  55.      leds[dot+10] = CRGB::Black;
  56.      leds[dot+20] = CRGB::Orange;
  57.      leds[dot+30] = CRGB::Black;
  58.      leds[dot+40] = CRGB::Orange;
  59.      leds[dot+50] = CRGB::Black;
  60.    }
  61.  
  62.  
  63. }
  64.  
  65. void loop() {
  66.  // put your main code here, to run repeatedly:
  67.  
  68. }
Advertisement
Add Comment
Please, Sign In to add comment