Я пытался сделать устройство alexa с wemos d1 mini и arduino ide. Я начал с примера под названием «fauxmoESP_basi c», который включен в библиотеку fauxmoESP . Затем я внедрил библиотеку adafruit neopixel для управления некоторыми из моих RGB-светодиодов ws2812b. В этот момент я могу повернуть все светодиоды к одному цвету. Но я хотел сделать этот эффект радуги, как в примере скетча из библиотеки adafruit neopixel, который назывался "strandtest".
Функция выглядит так:
void theaterChaseRainbow(int wait) {
int firstPixelHue = 0; // First pixel starts at red (hue 0)
for(int a=0; a<30; a++) { // Repeat 30 times...
for(int b=0; b<3; b++) { // 'b' counts from 0 to 2...
strip.clear(); // Set all pixels in RAM to 0 (off)
// 'c' counts up from 'b' to end of strip in increments of 3...
for(int c=b; c<strip.numPixels(); c += 3) {
// hue of pixel 'c' is offset by an amount to make one full
// revolution of the color wheel (range 65536) along the length
// of the strip (strip.numPixels() steps):
int hue = firstPixelHue + c * 65536L / strip.numPixels();
uint32_t color = strip.gamma32(strip.ColorHSV(hue)); // hue -> RGB
strip.setPixelColor(c, color); // Set pixel 'c' to value 'color'
}
strip.show(); // Update strip with new contents
delay(wait); // Pause for a moment
firstPixelHue += 65536 / 90; // One cycle of color wheel over 90 frames
}
}
}
Но потому что вы не можете используйте задержку, вам нужно использовать millis (), чтобы запустить его. Как только я решил использовать millis (), я понял, что вы не можете использовать millis () вместе с for-l oop. Поэтому я попытался переписать всю функцию. Это мое решение:
if(a < 30) {
if(b < 3) {
strip.clear();
if(c < strip.numPixels()) {
int hue = firstPixelHue + c * 65536L / strip.numPixels();
uint32_t color = strip.gamma32(strip.ColorHSV(hue));
strip.setPixelColor(c, color);
c += 3;
} else {
strip.show();
unsigned long currentMillis = millis();
if(currentMillis - previousMillis > 50) {
firstPixelHue += 65536 / 90;
b++;
c = b;
}
}
} else {
b = 0;
a++;
}
}
Должно работать. Я не вижу ошибки. Я надеюсь, что вы можете мне помочь. каждый раз, когда я выполняю эту функцию, происходит сбой, и я получаю это через последовательный монитор:
Exception (28):
epc1=0x4020b67e epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000
>>>stack>>>
ctx: sys
sp: 3fffe8d0 end: 3fffffb0 offset: 0190
3fffea60: 00000000 00000017 3fffeb40 4020db90
3fffea70: 3fffeb70 00000000 3fffead0 40209df5
3fffea80: 00000001 00000000 3fffebe0 00000002
3fffea90: 3ffe8304 00000002 3fffeb70 4020dc5a
3fffeaa0: 3fffeb13 3ffe8644 00000000 00000000
3fffeab0: 00000002 00000052 3f302064 3ffe8648
3fffeac0: 00000000 3ffe8647 3fffeb70 4020e08b
3fffead0: 00000000 ffffffff 00000000 00000000
3fffeae0: 00000001 00000012 3f302073 00000218
3fffeaf0: 3fff06cc 00000000 00000020 40100af0
3fffeb00: 3fffec10 3fffec00 00000018 00000218
3fffeb10: 00320274 0000005a 00000000 40219bec
3fffeb20: 646e6569 614e796c 00000000 4020ff85
3fffeb30: 3fffeca0 3fffec70 00000010 3ffe8304
3fffeb40: 00000001 00000009 00000001 4021441d
3fffeb50: 00000000 0000197b 00000000 3fffed30
3fffeb60: 3ffee654 3ffe8304 00000040 4020b5a9
3fffeb70: 3fffec32 00000000 0000002d ffff0208
3fffeb80: 3fffec20 0000003f e9ba5e35 00000000
3fffeb90: 00000000 00000000 4bc6a7f0 00000000
3fffeba0: 0000004f 0000004f 40100318 0007e49e
3fffebb0: 00000000 3fff0804 3fffece0 3fff06cc
3fffebc0: 092057be 3fff0804 0000004f 40203e6d
3fffebd0: 3fffece0 00000000 0000005a 3fffeca0
3fffebe0: 3ffe879d 00000008 00000000 4020b5ec
3fffebf0: 3fffeca0 3fffec70 00000008 40203ea8
3fffec00: 4022be8e 3fff0804 00000000 40203ee8
3fffec10: 3fffece0 0000004f 00000020 40204b64
3fffec20: 49414d5b 44205d4e 63697665 32232065
3fffec30: 50542820 312e312f 30303220 0d4b4f20
3fffec40: 6e6f430a 746e6574 7079542d 74203a65
3fffec50: 2f747865 0d6c6d78 6e6f430a 746e6574
3fffec60: 3fffeca0 3fffec70 00000008 6e6f430a
3fffec70: 7463656e 3a6e6f69 00000002 00000000
3fffec80: 3ffe862c 00000001 3ffef1fc 4020b660
3fffec90: 3ffe8633 3fff0804 3fffec70 3fffeca0
3fffeca0: 00000068 3ffe87a4 4023e9ae 3fffed30
3fffecb0: 3ffef87c 00000001 00000000 40201109
3fffecc0: 00000010 3fffece0 3ffee5ac 402034f4
3fffecd0: 00000001 402404fd 3fffed80 40205106
3fffece0: 73227b5b 65636375 3a227373 6c2f227b
3fffecf0: 74686769 2f332f73 74617473 6e6f2f65
3fffed00: 72743a22 7d7d6575 73227b2c 65636375
3fffed10: 3a227373 6c2f227b 74686769 2f332f73
3fffed20: 74617473 72622f65 313a2269 005d7d7d
3fffed30: 00007fff 0000000b 3fffed80 4020523c
3fffed40: 736c6100 00650065 80006570 402053b4
3fffed50: 00000002 3fff0804 3fffed30 4023e95d
3fffed60: 3fffedd0 3fffeddc 3ffee5ac 3fffeddc
3fffed70: 3fffedd0 3fff0804 3ffee5ac 402035c4
3fffed80: 3fff07d4 000b000f 00ffedd0 3fff078c
3fffed90: 003c003f 0000009e 0000009e 4010081c
3fffeda0: 00000000 00000001 3fffedd0 4020523c
3fffedb0: 3ffee5ac 3fffedd0 3fff09d6 3fff0804
3fffedc0: 3ffee5ac 3fff0936 3fff09d6 40203684
3fffedd0: 3fff04ec 000b000f 00c6a7f0 3ffeeef4
3fffede0: 003c003f 00000000 40100318 0007e49d
3fffedf0: 00000009 3fff0804 3fff04ec 40219c0c
3fffee00: 0920567d 3fff0804 00000000 3fff08ec
3fffee10: 00000000 3fffee60 3fff0804 402036c9
3fffee20: 00000000 3fffee60 3fff0804 40204126
3fffee30: 3fff06cc 3fff0804 3fff06cc 3ffeea8c
3fffee40: 3fff007d 00000000 00000020 3fff06cc
3fffee50: 3fff08ec 00000000 3fff0804 402042ce
3fffee60: 3ffeef44 3fff0504 00000000 3ffeea8c
3fffee70: 3ffeec30 3ffeece0 3fff08ec 3ffeea8c
3fffee80: 3fff06cc 3ffeea70 3ffeea71 402132b4
3fffee90: 00001ba0 00000000 00000020 40100af0
3fffeea0: 3ffeec30 59b2a8c0 3ffee780 3ffef40c
3fffeeb0: 00000000 00000000 00000020 3ffeece0
3fffeec0: 3ffeec30 3fff090a 3fff08ec 40218e92
3fffeed0: 00000014 3ffeec30 000000e5 3ffef40c
3fffeee0: 00000000 3ffef36c 00000020 40100abb
3fffeef0: 4022b0b8 3fff04ec 3ffef36c 3ffef40c
3fffef00: 00000008 3ffeec30 3fff08ec 4020fea5
3fffef10: 3fffdc80 3ffef36c 3fff04ec 4020fcc4
3fffef20: 4022fdce 3ffef36c 3fff04ec 4022fddf
3fffef30: 3fff08fc 3fff08ec 00000000 3ffe84f4
3fffef40: 4022ace3 00000000 3fff04ec 40231a7b
3fffef50: 40000f49 3fffdab0 3fffdab0 40000f49
3fffef60: 40000e19 00000005 0004851c 00000000
3fffef70: 00000000 ffffffff ffffffff 40104a55
3fffef80: 40104a5b 0004851c 00000000 65736965
3fffef90: 4010000d 52007474 7365746f 74654220
3fffefa0: 00000000 3fffef3c 00000000 3ffffec8
3fffefb0: 3fffffc0 00000000 00000000 feefeffe
3fffefc0: feefeffe feefeffe feefeffe feefeffe
3fffefd0: feefeffe feefeffe feefeffe feefeffe
3fffefe0: feefeffe feefeffe feefeffe feefeffe
3fffeff0: feefeffe feefeffe feefeffe feefeffe
3ffff000: feefeffe feefeffe feefeffe feefeffe
3ffff010: feefeffe feefeffe feefeffe feefeffe
3ffff020: feefeffe feefeffe feefeffe feefeffe
3ffff030: feefeffe feefeffe feefeffe feefeffe
3ffff040: feefeffe feefeffe feefeffe feefeffe
3ffff050: feefeffe feefeffe feefeffe feefeffe
3ffff060: feefeffe feefeffe feefeffe feefeffe
3ffff070: feefeffe feefeffe feefeffe feefeffe
3ffff080: feefeffe feefeffe feefeffe feefeffe
3ffff090: feefeffe feefeffe feefeffe feefeffe
3ffff0a0: feefeffe feefeffe feefeffe feefeffe
3ffff0b0: feefeffe feefeffe feefeffe feefeffe
3ffff0c0: feefeffe feefeffe feefeffe feefeffe
3ffff0d0: feefeffe feefeffe feefeffe feefeffe
3ffff0e0: feefeffe feefeffe feefeffe feefeffe
3ffff0f0: feefeffe feefeffe feefeffe feefeffe
3ffff100: feefeffe feefeffe feefeffe feefeffe
3ffff110: feefeffe feefeffe feefeffe feefeffe
3ffff120: feefeffe feefeffe feefeffe feefeffe
3ffff130: feefeffe feefeffe feefeffe feefeffe
3ffff140: feefeffe feefeffe feefeffe feefeffe
3ffff150: feefeffe feefeffe feefeffe feefeffe
3ffff160: feefeffe feefeffe feefeffe feefeffe
3ffff170: feefeffe feefeffe feefeffe feefeffe
3ffff180: feefeffe feefeffe feefeffe feefeffe
3ffff190: feefeffe feefeffe feefeffe feefeffe
3ffff1a0: feefeffe feefeffe feefeffe feefeffe
3ffff1b0: feefeffe feefeffe feefeffe feefeffe
3ffff1c0: feefeffe feefeffe feefeffe feefeffe
3ffff1d0: feefeffe feefeffe feefeffe feefeffe
3ffff1e0: feefeffe feefeffe feefeffe feefeffe
3ffff1f0: feefeffe feefeffe feefeffe feefeffe
3ffff200: feefeffe feefeffe feefeffe feefeffe
3ffff210: feefeffe feefeffe feefeffe feefeffe
3ffff220: feefeffe feefeffe feefeffe feefeffe
3ffff230: feefeffe feefeffe feefeffe feefeffe
3ffff240: feefeffe feefeffe feefeffe feefeffe
3ffff250: feefeffe feefeffe feefeffe feefeffe
3ffff260: feefeffe feefeffe feefeffe feefeffe
3ffff270: feefeffe feefeffe feefeffe feefeffe
3ffff280: feefeffe feefeffe feefeffe feefeffe
3ffff290: feefeffe feefeffe feefeffe feefeffe
3ffff2a0: feefeffe feefeffe feefeffe feefeffe
3ffff2b0: feefeffe feefeffe feefeffe feefeffe
3ffff2c0: feefeffe feefeffe feefeffe feefeffe
3ffff2d0: feefeffe feefeffe feefeffe feefeffe
3ffff2e0: feefeffe feefeffe feefeffe feefeffe
3ffff2f0: feefeffe feefeffe feefeffe feefeffe
3ffff300: feefeffe feefeffe feefeffe feefeffe
3ffff310: feefeffe feefeffe feefeffe feefeffe
3ffff320: feefeffe feefeffe feefeffe feefeffe
3ffff330: feefeffe feefeffe feefeffe feefeffe
3ffff340: feefeffe feefeffe feefeffe feefeffe
3ffff350: feefeffe feefeffe feefeffe feefeffe
3ffff360: feefeffe feefeffe feefeffe feefeffe
3ffff370: feefeffe feefeffe feefeffe feefeffe
3ffff380: feefeffe feefeffe feefeffe feefeffe
3ffff390: feefeffe feefeffe feefeffe feefeffe
3ffff3a0: feefeffe feefeffe feefeffe feefeffe
3ffff3b0: feefeffe feefeffe feefeffe feefeffe
3ffff3c0: feefeffe feefeffe feefeffe feefeffe
3ffff3d0: feefeffe feefeffe feefeffe feefeffe
3ffff3e0: feefeffe feefeffe feefeffe feefeffe
3ffff3f0: feefeffe feefeffe feefeffe feefeffe
3ffff400: feefeffe feefeffe feefeffe feefeffe
3ffff410: feefeffe feefeffe feefeffe feefeffe
3ffff420: feefeffe feefeffe feefeffe feefeffe
3ffff430: feefeffe feefeffe feefeffe feefeffe
3ffff440: feefeffe feefeffe feefeffe feefeffe
3ffff450: feefeffe feefeffe feefeffe feefeffe
3ffff460: feefeffe feefeffe feefeffe feefeffe
3ffff470: feefeffe feefeffe feefeffe feefeffe
3ffff480: feefeffe feefeffe feefeffe feefeffe
3ffff490: feefeffe feefeffe feefeffe feefeffe
3ffff4a0: feefeffe feefeffe feefeffe feefeffe
3ffff4b0: feefeffe feefeffe feefeffe feefeffe
3ffff4c0: feefeffe feefeffe feefeffe feefeffe
3ffff4d0: feefeffe feefeffe feefeffe feefeffe
3ffff4e0: feefeffe feefeffe feefeffe feefeffe
3ffff4f0: feefeffe feefeffe feefeffe feefeffe
3ffff500: feefeffe feefeffe feefeffe feefeffe
3ffff510: feefeffe feefeffe feefeffe feefeffe
3ffff520: feefeffe feefeffe feefeffe feefeffe
3ffff530: feefeffe feefeffe feefeffe feefeffe
3ffff540: feefeffe feefeffe feefeffe feefeffe
3ffff550: feefeffe feefeffe feefeffe feefeffe
3ffff560: feefeffe feefeffe feefeffe feefeffe
3ffff570: feefeffe feefeffe feefeffe feefeffe
3ffff580: feefeffe feefeffe feefeffe feefeffe
3ffff590: feefeffe feefeffe feefeffe feefeffe
3ffff5a0: feefeffe feefeffe feefeffe feefeffe
3ffff5b0: feefeffe feefeffe feefeffe feefeffe
3ffff5c0: feefeffe feefeffe feefeffe feefeffe
3ffff5d0: feefeffe feefeffe feefeffe feefeffe
3ffff5e0: feefeffe feefeffe feefeffe feefeffe
3ffff5f0: feefeffe feefeffe feefeffe feefeffe
3ffff600: feefeffe feefeffe feefeffe feefeffe
3ffff610: feefeffe feefeffe feefeffe feefeffe
3ffff620: feefeffe feefeffe feefeffe feefeffe
3ffff630: feefeffe feefeffe feefeffe feefeffe
3ffff640: feefeffe feefeffe feefeffe feefeffe
3ffff650: feefeffe feefeffe feefeffe feefeffe
3ffff660: feefeffe feefeffe feefeffe feefeffe
3ffff670: feefeffe feefeffe feefeffe feefeffe
3ffff680: feefeffe feefeffe feefeffe feefeffe
3ffff690: feefeffe feefeffe feefeffe feefeffe
3ffff6a0: feefeffe feefeffe feefeffe feefeffe
3ffff6b0: feefeffe feefeffe feefeffe feefeffe
3ffff6c0: feefeffe feefeffe feefeffe feefeffe
3ffff6d0: feefeffe feefeffe feefeffe feefeffe
3ffff6e0: feefeffe feefeffe feefeffe feefeffe
3ffff6f0: feefeffe feefeffe feefeffe feefeffe
3ffff700: feefeffe feefeffe feefeffe feefeffe
3ffff710: feefeffe feefeffe feefeffe feefeffe
3ffff720: feefeffe feefeffe feefeffe feefeffe
3ffff730: feefeffe feefeffe feefeffe feefeffe
3ffff740: feefeffe feefeffe feefeffe feefeffe
3ffff750: feefeffe feefeffe feefeffe feefeffe
3ffff760: feefeffe feefeffe feefeffe feefeffe
3ffff770: feefeffe feefeffe feefeffe feefeffe
3ffff780: feefeffe feefeffe feefeffe feefeffe
3ffff790: feefeffe feefeffe feefeffe feefeffe
3ffff7a0: feefeffe feefeffe feefeffe feefeffe
3ffff7b0: feefeffe feefeffe feefeffe feefeffe
3ffff7c0: feefeffe feefeffe feefeffe feefeffe
3ffff7d0: feefeffe feefeffe feefeffe feefeffe
3ffff7e0: feefeffe feefeffe feefeffe feefeffe
3ffff7f0: feefeffe feefeffe feefeffe feefeffe
3ffff800: feefeffe feefeffe feefeffe feefeffe
3ffff810: feefeffe feefeffe feefeffe feefeffe
3ffff820: feefeffe feefeffe feefeffe feefeffe
3ffff830: feefeffe feefeffe feefeffe feefeffe
3ffff840: feefeffe feefeffe feefeffe feefeffe
3ffff850: feefeffe feefeffe feefeffe feefeffe
3ffff860: 00000005 00000000 00000020 40100220
3ffff870: feefeffe feefeffe 00000005 401016a4
3ffff880: 3ffe8c75 4010494f 3ffec700 feefeffe
3ffff890: 4010223b 3ffec700 feefeffe feefeffe
3ffff8a0: 00000005 00000000 00000020 40100220
3ffff8b0: 3ffe9508 00000000 00000005 401016a4
3ffff8c0: 3ffe8c75 4010494f 3ffec700 00000100
3ffff8d0: 4010223b 3ffec700 00000000 00000001
3ffff8e0: 0000000a 14011d26 3ffed0d0 40102418
3ffff8f0: 3ffe94fc 00000000 00000000 131cf478
3ffff900: 0000000a 14011d26 401028da 00000100
3ffff910: 3ffe94fc 7fffffff 00000000 00000001
3ffff920: 00000001 00006208 0000001f ffffffff
3ffff930: 3ffe94fc 00000001 0000a000 14011d26
3ffff940: 3ffe9508 2c9f0300 4000050c 3fffc278
3ffff950: 401025fc 3fffc200 00000022 a0000000
3ffff960: 00000005 00000000 00000020 40100220
3ffff970: 4020dc5a 3fffffff 00000005 401016a4
3ffff980: 3ffe8c75 4010494f 3ffec700 0000000b
3ffff990: 4010223b 3ffec700 00000002 3ffffc9c
3ffff9a0: 0000000b 1a604e13 3ffed0d0 40102418
3ffff9b0: 3ffe9514 00000000 00000000 ffffffff
3ffff9c0: 0000000b 1a604e13 401028da 00000100
3ffff9d0: 3ffe9514 7fffffff 00000000 00000001
3ffff9e0: 00000001 00006208 00000014 40100220
3ffff9f0: 3ffe9514 3ffec408 00000001 1a604e13
3ffffa00: 3ffe9520 2c9f0300 4000050c 3fffc278
3ffffa10: 401025fc 3fffc200 00000022 00000000
3ffffa20: 00000008 00000000 0000000a 00000000
3ffffa30: 00000008 00000000 4022be3f 00000001
3ffffa40: 00000001 00000000 00000014 40100220
3ffffa50: 4022be8e 3ffec408 00000001 4022f9b7
3ffffa60: 4022bf72 3ffec408 401017df 3ffec408
3ffffa70: 00000014 00000020 00000008 3fff0b0c
3ffffa80: 4022af00 3ffec408 3ffecb80 00000020
3ffffa90: 00000000 4021e4fb 3ffed898 3ffefc8c
3ffffaa0: 00000000 00000002 00000000 3ffec408
3ffffab0: 3fff0b26 40104f9f 3ffef1fc 3ffee848
3ffffac0: 3ffef36c 3ffec6d8 3ffef1fc 4020db90
3ffffad0: 3ffffbd0 4020f885 3ffef1fc 3ffee848
3ffffae0: 0000000c 00000000 00000000 00000015
3ffffaf0: 00000000 00000015 3ffffbd0 00000000
3ffffb00: 3ffeec68 3ffeec30 3fff0ae4 4020fb12
3ffffb10: 00000001 3ffeec30 3fff0ae4 4020ff30
3ffffb20: 3ffeeac4 4023e581 3ffffbd0 4020de44
3ffffb30: 00000000 0000000c 00000000 3ffeeac8
3ffffb40: 3ffeec68 00000000 3ffeec30 402175a0
3ffffb50: 40205957 00000030 00000000 ffffffff
3ffffb60: 00000000 3fff0ae4 3ffffc9c 3ffffc90
3ffffb70: 00303831 00ff5800 3ffe887d 3fff0ae4
3ffffb80: 3fff0ae4 3ffeef70 3ffeec30 402177f4
3ffffb90: 3fff0000 3ffffc90 00000030 3ffe8304
3ffffba0: 3fff0b34 3ffeef70 3ffeec30 402190f4
3ffffbb0: 00000014 3ffeec34 00000000 3fffff10
3ffffbc0: 00000000 00000000 00000020 40100220
3ffffbd0: 00000011 3ffeebb8 00000000 401016a4
3ffffbe0: 3ffe8c70 40104937 3ffec520 3fff0ae4
3ffffbf0: 00000001 40103b12 3ffecdf0 4021918a
3ffffc00: 40103f83 00000000 00000000 40219cf7
3ffffc10: 00000000 00000000 00000020 40100220
3ffffc20: 00000000 00000000 00000020 40100220
3ffffc30: 00000000 00000000 00000000 401016a4
3ffffc40: 3ffe8c70 40104937 3ffec520 401016a4
3ffffc50: 00000001 40103b12 3ffecdf0 4010081c
3ffffc60: 40103f83 2c9f0300 4000050c 3fffc278
3ffffc70: 401025fc 3fffc200 00000022 00040000
3ffffc80: 40103a4b 00000040 00000000 00040000
3ffffc90: 00000000 00000000 8020f73d 8020f73d
3ffffca0: 40102914 00080000 ff000000 000a0d0a
3ffffcb0: 322e3535 00000000 00000002 3fffff34
3ffffcc0: 00000110 2c9f0300 4000050c 3fffc278
3ffffcd0: 401025fc 3fffc200 00000022 3fffc278
3ffffce0: 4020502d 00000030 00000010 ffffffff
3ffffcf0: 00001ad0 3fffff34 00000080 00000080
3ffffd00: 00000080 0000000a 0000000d 00000000
3ffffd10: 3ffee80c 00000110 00000020 40100af0
3ffffd20: 3fffff34 3fffff10 3fffff10 00000030
3ffffd30: 00000005 00000000 00000020 40100220
3ffffd40: 00000005 00000000 00000020 40100220
3ffffd50: 00000005 00000000 00000005 401016a4
3ffffd60: 3ffe8c75 4010494f 3ffec700 401016a4
3ffffd70: 4010223b 3ffec700 3ffec700 3ffecdf0
3ffffd80: 00007fff 1ed503dd 3ffed0d0 40102418
3ffffd90: 3ffe952c 00000000 00000000 40102418
3ffffda0: 00007fff 1ed503dd 401028da 00000100
3ffffdb0: 3ffe952c 7fffffff 00002200 00000001
3ffffdc0: 00000001 00004288 00000000 00000001
3ffffdd0: 3ffe952c 00004288 3ffecdf0 1ed503dd
3ffffde0: 3ffe94f0 2c9f0300 4000050c 3fffc278
3ffffdf0: 401025fc 3fffc200 00000022 3fffc278
3ffffe00: 40202c19 00000030 0000001b ffffffff
3ffffe10: 40202c08 00003e80 000000c6 43b300f8
3ffffe20: 00000000 00000000 00000000 fffffffe
3ffffe30: ffffffff 3fffc6fc 00000001 00000000
3ffffe40: 3ffee5cc 3fffdad0 3fffff10 00000030
3ffffe50: 00000000 3fffdad0 3ffee780 00000030
3ffffe60: 40207431 2c9f0300 4000050c 3fffc278
3ffffe70: 401025fc 3fffc200 00000022 43a3a23f
3ffffe80: 40000f83 00000030 0000001c ffffffff
3ffffe90: 40000ea3 00000023 00000001 00000001
3ffffea0: 3fffdab0 00000000 3fffd9d0 3ffee780
3ffffeb0: 00000000 00000000 00000001 00000020
3ffffec0: 00000000 3fffdad0 3ffee780 00000030
3ffffed0: 00000000 00000000 00000000 fffffffe
3ffffee0: ffffffff 3fffc6fc 00000001 3ffee740
3ffffef0: 00000000 3ffee5cc 00000000 40202c08
3fffff00: 00000000 3ffee5ac 3ffee740 40203b20
3fffff10: 45532d00 48435241 80000000 40100abb
3fffff20: 3fffdad0 40201031 3fff0400 000d000f
3fffff30: 80ffdad0 3fff0800 010b010f 8020f73d
3fffff40: 3ffee5cc 3ffeeebc 00000001 4020103f
3fffff50: 3ffef854 00000000 3ffee5ac 3ffee780
3fffff60: 00f42400 43b306cb 3ffee700 40203bf5
3fffff70: 00000000 00000000 00000000 40201477
3fffff80: 00000000 00000000 00000001 40100220
3fffff90: 3fffdad0 00000000 3ffee740 40100241
3fffffa0: 3fffdad0 00000000 3ffee740 40205eed
<<<stack<<<
ets Jan 8 2013,rst cause:2, boot mode:(3,6)
load 0x4010f000, len 3456, room 16
tail 0
chksum 0x84
csum 0x84
va5432625
~ld
ets Jan 8 2013,rst cause:2, boot mode:(3,6)
load 0x4010f000, len 3456, room 16
tail 0
chksum 0x84
csum 0x84
va5432625
~ld
ets Jan 8 2013,rst cause:2, boot mode:(3,6)
load 0x4010f000, len 3456, room 16
tail 0
chksum 0x84
csum 0x84
va5432625
~ld
ets Jan 8 2013,rst cause:2, boot mode:(3,6)
load 0x4010f000, len 3456, room 16
tail 0
chksum 0x84
csum 0x84
va5432625
~ld
ets Jan 8 2013,rst cause:2, boot mode:(3,6)
load 0x4010f000, len 3456, room 16
tail 0
chksum 0x84
csum 0x84
va5432625
~ld
ets Jan 8 2013,rst cause:2, boot mode:(3,6)
load 0x4010f000, len 3456, room 16
tail 0
chksum 0x84
csum 0x84
va5432625
~ld
Я не знаю, что я сделал не так. Надеюсь, кто-нибудь сможет мне помочь. Для (возможно) лучшего понимания вот мой весь набросок Arduino:
#include <Arduino.h>
#include <Adafruit_NeoPixel.h>
#ifdef ESP32
#include <WiFi.h>
#else
#include <ESP8266WiFi.h>
#endif
#include "fauxmoESP.h"
// Rename the credentials.sample.h file to credentials.h and
// edit it according to your router configuration
#include "credentials.h"
fauxmoESP fauxmo;
// -----------------------------------------------------------------------------
#define SERIAL_BAUDRATE 115200
#define LED_PIN D1
#define LED_COUNT 194
// -----------------------------------------------------------------------------
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
// -----------------------------------------------------------------------------
// Wifi
// -----------------------------------------------------------------------------
int rb = 0;
int rt = 0;
long previousMillis = 0;
long firstPixelHue = 0;
int i = 0;
int a = 0;
int b = 0;
int c = 0;
int hue = 0;
uint32_t color;
void wifiSetup() {
// Set WIFI module to STA mode
WiFi.mode(WIFI_STA);
// Connect
Serial.printf("[WIFI] Connecting to %s ", WIFI_SSID);
WiFi.begin(WIFI_SSID, WIFI_PASS);
// Wait
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(100);
}
Serial.println();
// Connected!
Serial.printf("[WIFI] STATION Mode, SSID: %s, IP address: %s\n", WiFi.SSID().c_str(), WiFi.localIP().toString().c_str());
}
void setup() {
// Init serial port and clean garbage
Serial.begin(SERIAL_BAUDRATE);
Serial.println();
Serial.println();
// LEDs
strip.begin();
strip.show();
strip.setBrightness(150);
// Wifi
wifiSetup();
// By default, fauxmoESP creates it's own webserver on the defined port
// The TCP port must be 80 for gen3 devices (default is 1901)
// This has to be done before the call to enable()
fauxmo.createServer(true); // not needed, this is the default value
fauxmo.setPort(80); // This is required for gen3 devices
// You have to call enable(true) once you have a WiFi connection
// You can enable or disable the library at any moment
// Disabling it will prevent the devices from being discovered and switched
fauxmo.enable(true);
// You can use different ways to invoke alexa to modify the devices state:
// "Alexa, turn yellow lamp on"
// "Alexa, turn on yellow lamp
// "Alexa, set yellow lamp to fifty" (50 means 50% of brightness, note, this example does not use this functionality)
// Add virtual devices
// fauxmo.addDevice("Bett");
// fauxmo.addDevice("Weises Bett");
// fauxmo.addDevice("Rotes Bett");
// fauxmo.addDevice("Blaues Bett");
// fauxmo.addDevice("Grünes Bett");
// fauxmo.addDevice("Gelbes Bett");
// fauxmo.addDevice("Rosa Bett");
// fauxmo.addDevice("Türkis Bett");
// fauxmo.addDevice("Oranges Bett");
// fauxmo.addDevice("Hellblaues Bett");
// fauxmo.addDevice("Hellgrünes Bett");
// fauxmo.addDevice("Hellrotes Bett");
fauxmo.addDevice("Regenbogenmodus");
fauxmo.addDevice("Regenbogenreihe");
fauxmo.onSetState([](unsigned char device_id, const char * device_name, bool state, unsigned char value) {
// Callback when a command from Alexa is received.
// You can use device_id or device_name to choose the element to perform an action onto (relay, LED,...)
// State is a boolean (ON/OFF) and value a number from 0 to 255 (if you say "set kitchen light to 50%" you will receive a 128 here).
// Just remember not to delay too much here, this is a callback, exit as soon as possible.
// If you have to do something more involved here set a flag and process it in your main loop.
Serial.printf("[MAIN] Device #%d (%s) state: %s value: %d\n", device_id, device_name, state ? "ON" : "OFF", value);
// Checking for device_id is simpler if you are certain about the order they are loaded and it does not change.
// Otherwise comparing the device_name is safer.
if (strcmp(device_name, "Bett")==0) {
if(state) {
strip.fill(strip.Color(255, 255, 255), 0, LED_COUNT);
} else {
strip.fill(strip.Color(0, 0, 0), 0, LED_COUNT);
}
strip.show();
} else if (strcmp(device_name, "Weises Bett")==0) {
strip.fill(strip.Color(255, 255, 255), 0, LED_COUNT);
strip.show();
} else if (strcmp(device_name, "Rotes Bett")==0) {
strip.fill(strip.Color(255, 0, 0), 0, LED_COUNT);
strip.show();
} else if (strcmp(device_name, "Blaues Bett")==0) {
strip.fill(strip.Color(0, 0, 255), 0, LED_COUNT);
strip.show();
} else if (strcmp(device_name, "Grünes Bett")==0) {
strip.fill(strip.Color(0, 255, 0), 0, LED_COUNT);
strip.show();
} else if (strcmp(device_name, "Gelbes Bett")==0) {
strip.fill(strip.Color(255, 255, 0), 0, LED_COUNT);
strip.show();
} else if (strcmp(device_name, "Türkis Bett")==0) {
strip.fill(strip.Color(0, 255, 255), 0, LED_COUNT);
strip.show();
} else if (strcmp(device_name, "Rosa Bett")==0) {
strip.fill(strip.Color(255, 0, 255), 0, LED_COUNT);
strip.show();
} else if (strcmp(device_name, "Hellblaues Bett")==0) {
strip.fill(strip.Color(0, 200, 255), 0, LED_COUNT);
strip.show();
} else if (strcmp(device_name, "Hellgrünes Bett")==0) {
strip.fill(strip.Color(110, 255, 110), 0, LED_COUNT);
strip.show();
} else if (strcmp(device_name, "Hellrotes Bett")==0) {
strip.fill(strip.Color(255, 80, 80), 0, LED_COUNT);
strip.show();
} else if (strcmp(device_name, "Regenbogenmodus")==0) {
if(state) {
firstPixelHue = 0;
previousMillis = 0;
int pixelHue = 0;
i = 0;
rt = 0;
rb = 1;
} else {
rb = 0;
strip.fill(strip.Color(0, 0, 0), 0, LED_COUNT);
strip.show();
}
} else if (strcmp(device_name, "Regenbogenreihe")==0) {
if(state) {
firstPixelHue = 0;
previousMillis = 0;
a = 0;
b = 0;
c = 0;
hue = 0;
uint32_t color = 0;
rb = 0;
rt = 1;
} else {
rt = 0;
strip.fill(strip.Color(0, 0, 0), 0, LED_COUNT);
strip.show();
}
}
});
}
void loop() {
// fauxmoESP uses an async TCP server but a sync UDP server
// Therefore, we have to manually poll for UDP packets
fauxmo.handle();
if(rb == 1) {
unsigned long currentMillis = millis();
if(currentMillis - previousMillis > 10) {
previousMillis = currentMillis;
if(firstPixelHue < 5*65536) {
if(i < strip.numPixels()) {
int pixelHue = firstPixelHue + (i * 65536L / strip.numPixels());
strip.setPixelColor(i, strip.gamma32(strip.ColorHSV(pixelHue)));
i++;
}
strip.show();
firstPixelHue += 256;
}
}
}
if(rt == 1) {
if(a < 30) {
if(b < 3) {
strip.clear();
if(c < strip.numPixels()) {
int hue = firstPixelHue + c * 65536L / strip.numPixels();
uint32_t color = strip.gamma32(strip.ColorHSV(hue));
strip.setPixelColor(c, color);
c += 3;
} else {
strip.show();
unsigned long currentMillis = millis();
if(currentMillis - previousMillis > 50) {
firstPixelHue += 65536 / 90;
b++;
c = b;
}
}
} else {
b = 0;
a++;
}
}
}
// This is a sample code to output free heap every 5 seconds
// This is a cheap way to detect memory leaks
// If your device state is changed by any other means (MQTT, physical button,...)
// you can instruct the library to report the new state to Alexa on next request:
// fauxmo.setState(ID_YELLOW, true, 255);
}
Я благодарен за каждый ответ.