diff --git a/Adafruit_Prop_Maker_FeatherWing/Prop_Maker_LED_Simpletest/Prop_Maker_LED_Simpletest.ino b/Adafruit_Prop_Maker_FeatherWing/Prop_Maker_LED_Simpletest/Prop_Maker_LED_Simpletest.ino index 721e3d2ea..20de27216 100644 --- a/Adafruit_Prop_Maker_FeatherWing/Prop_Maker_LED_Simpletest/Prop_Maker_LED_Simpletest.ino +++ b/Adafruit_Prop_Maker_FeatherWing/Prop_Maker_LED_Simpletest/Prop_Maker_LED_Simpletest.ino @@ -62,6 +62,10 @@ uint8_t i=0; +uint8_t red_out = RED_LED; +uint8_t green_out = GREEN_LED; +uint8_t blue_out = BLUE_LED; + void setup() { Serial.begin(115200); Serial.println("\nProp-Maker Wing: LED Example"); @@ -73,21 +77,32 @@ void setup() { // Set up the LED Pins #if defined(ESP32) // and ESP32-S2! - ledcSetup(RED_LED, 5000, 8); - ledcAttachPin(RED_PIN, RED_LED); - ledcSetup(GREEN_LED, 5000, 8); - ledcAttachPin(GREEN_PIN, GREEN_LED); - ledcSetup(BLUE_LED, 5000, 8); - ledcAttachPin(BLUE_PIN, BLUE_LED); + #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 1, 1) + // newer LEDC API, use pins instead of channel + red_out = RED_PIN; + green_out = GREEN_PIN; + blue_out = BLUE_PIN; + ledcAttach(RED_PIN, 5000, 8); + ledcAttach(GREEN_PIN, 5000, 8); + ledcAttach(BLUE_PIN, 5000, 8); + #else + // older LEDC API, use channel, attach pin to channel + ledcSetup(RED_LED, 5000, 8); + ledcAttachPin(RED_PIN, RED_LED); + ledcSetup(GREEN_LED, 5000, 8); + ledcAttachPin(GREEN_PIN, GREEN_LED); + ledcSetup(BLUE_LED, 5000, 8); + ledcAttachPin(BLUE_PIN, BLUE_LED); + #endif #else - pinMode(RED_LED, OUTPUT); - pinMode(GREEN_LED, OUTPUT); - pinMode(BLUE_LED, OUTPUT); + pinMode(red_out, OUTPUT); + pinMode(green_out, OUTPUT); + pinMode(blue_out, OUTPUT); #endif - analogWrite(RED_LED, 0); - analogWrite(GREEN_LED, 0); - analogWrite(BLUE_LED, 0); + analogWrite(red_out, 0); + analogWrite(green_out, 0); + analogWrite(blue_out, 0); } uint32_t Color(uint8_t r, uint8_t g, uint8_t b) { @@ -119,8 +134,8 @@ void loop() digitalWrite(POWER_PIN, HIGH); // write colors to the 3W LED - analogWrite(RED_LED, red); - analogWrite(GREEN_LED, green); - analogWrite(BLUE_LED, blue); + analogWrite(red_out, red); + analogWrite(green_out, green); + analogWrite(blue_out, blue); delay(2); -} +} \ No newline at end of file diff --git a/Factory_Tests/Qualia_ESP32S3_RGB666_FactoryTest/.qualia_s3_rgb666.test.only b/Factory_Tests/Qualia_ESP32S3_RGB666_FactoryTest/.none.test.only similarity index 100% rename from Factory_Tests/Qualia_ESP32S3_RGB666_FactoryTest/.qualia_s3_rgb666.test.only rename to Factory_Tests/Qualia_ESP32S3_RGB666_FactoryTest/.none.test.only diff --git a/Faz_Wrench/code.py b/Faz_Wrench/code.py new file mode 100644 index 000000000..2b759bb33 --- /dev/null +++ b/Faz_Wrench/code.py @@ -0,0 +1,179 @@ +# SPDX-FileCopyrightText: Copyright (c) 2023 Liz Clark for Adafruit Industries +# +# SPDX-License-Identifier: MIT + +import os +import random +import board +import audiocore +import audiobusio +import audiomixer +from digitalio import DigitalInOut, Direction +import neopixel +from adafruit_ticks import ticks_ms, ticks_add, ticks_diff +from adafruit_led_animation.animation.pulse import Pulse +from adafruit_led_animation.color import RED, GREEN +import adafruit_character_lcd.character_lcd_i2c as character_lcd +import adafruit_lis3dh +from adafruit_seesaw.seesaw import Seesaw +from adafruit_seesaw.rotaryio import IncrementalEncoder +import keypad + +puzzle_time = 5 # seconds + +lcd_columns = 16 +lcd_rows = 2 + +# enable external power pin +# provides power to the external components +external_power = DigitalInOut(board.EXTERNAL_POWER) +external_power.direction = Direction.OUTPUT +external_power.value = True + +i2c = board.I2C() + +int1 = DigitalInOut(board.ACCELEROMETER_INTERRUPT) +lis3dh = adafruit_lis3dh.LIS3DH_I2C(i2c, int1=int1) +lis3dh.range = adafruit_lis3dh.RANGE_2_G + +ss_enc0 = Seesaw(i2c, addr=0x36) +enc0 = IncrementalEncoder(ss_enc0) + +button = keypad.Keys((board.EXTERNAL_BUTTON, board.D13,), value_when_pressed=False, pull=True) + +lcd = character_lcd.Character_LCD_I2C(i2c, lcd_columns, lcd_rows) +lcd.backlight = True + +puzzle_msgs = ["UNLOCK\nDOOR", "DOOR\nUNLOCKED", "UNLOCKING"] + +wavs = [] +for filename in os.listdir('/faz_sounds'): + if filename.lower().endswith('.wav') and not filename.startswith('.'): + wavs.append("/faz_sounds/"+filename) +wavs.sort() +print(wavs) + +audio = audiobusio.I2SOut(board.I2S_BIT_CLOCK, board.I2S_WORD_SELECT, board.I2S_DATA) +mixer = audiomixer.Mixer(voice_count=1, sample_rate=22050, channel_count=1, + bits_per_sample=16, samples_signed=True, buffer_size=32768) +volume = 0.5 +mixer.voice[0].level = volume +audio.play(mixer) +wav_length = len(wavs) - 1 + +def open_audio(num): + n = wavs[num] + f = open(n, "rb") + w = audiocore.WaveFile(f) + return w + +PIXEL_PIN = board.EXTERNAL_NEOPIXELS +BRIGHTNESS = 0.3 +NUM_PIXELS = 8 + +PIXELS = neopixel.NeoPixel(PIXEL_PIN, NUM_PIXELS, auto_write=True) +pulse = Pulse(PIXELS, speed=0.001, color=RED, period=3) + +puzzle_clock = ticks_ms() +puzzle_time = puzzle_time * 1000 + +puzzle = False +wave = open_audio(0) +pos0 = volume +last_pos0 = pos0 +node_num = 0 + +def normalize(val, min_v, max_v): + return max(min(max_v, val), min_v) + +def puzzle_string(length): + _string = "" + for _ in range(length/2): + b = random.randint(0, 1) + if b == 0: + r = chr(random.randint(ord('A'), ord('Z'))) + else: + r = str(random.randint(0, 9)) + _string += r + _string += "\n" + for _ in range(length/2): + b = random.randint(0, 1) + if b == 0: + r = chr(random.randint(ord('A'), ord('Z'))) + else: + r = str(random.randint(0, 9)) + _string += r + lcd.message = _string + return _string + +while True: + event = button.events.get() + if event and event.pressed: + number = event.key_number + if number == 0 and not puzzle: + pulse.fill(GREEN) + puzzle = True + lcd.clear() + lcd.message = puzzle_msgs[2] + wave = open_audio(1) + mixer.voice[0].play(wave) + while mixer.playing: + pass + puzzle_clock = ticks_add(ticks_ms(), puzzle_time) + if number == 1: + lcd.clear() + node_num = (node_num + 1) % 5 + print(node_num) + + if puzzle: + x, y, z = [ + value / adafruit_lis3dh.STANDARD_GRAVITY for value in lis3dh.acceleration + ] + puzzle_string(lcd_columns*lcd_rows) + if z > 0: + wave = open_audio(2) + print("playing up") + pulse.fill(GREEN) + else: + wave = open_audio(3) + print("playing down") + pulse.fill(RED) + mixer.voice[0].play(wave) + while mixer.playing: + puzzle_string(lcd_columns*lcd_rows) + x, y, z = [ + value / adafruit_lis3dh.STANDARD_GRAVITY for value in lis3dh.acceleration + ] + if z > 0: + pulse.fill(GREEN) + else: + pulse.fill(RED) + if ticks_diff(ticks_ms(), puzzle_clock) >= puzzle_time: + lcd.clear() + puzzle = False + lcd.message = puzzle_msgs[1] + wave = open_audio(4) + mixer.voice[0].play(wave) + while mixer.playing: + pass + print("puzzle done") + wave = open_audio(0) + lcd.clear() + pulse.fill(RED) + + if not puzzle: + pulse.animate() + mixer.voice[0].play(wave, loop=True) + if node_num > 3: + lcd.message = "SECURITY\nBREACHED" + else: + lcd.message = f"DEACTIVATED:\n{node_num} of 4" + pos0 = -enc0.position + if pos0 != last_pos0: + if pos0 > last_pos0: + volume = volume + 0.1 + else: + volume = volume - 0.1 + volume = normalize(volume, 0.0, 1.0) + mixer.voice[0].level = volume + last_pos0 = pos0 diff --git a/Faz_Wrench/faz_sounds/0_idle.wav b/Faz_Wrench/faz_sounds/0_idle.wav new file mode 100644 index 000000000..1ca807732 Binary files /dev/null and b/Faz_Wrench/faz_sounds/0_idle.wav differ diff --git a/Faz_Wrench/faz_sounds/1_start.wav b/Faz_Wrench/faz_sounds/1_start.wav new file mode 100644 index 000000000..3ec760970 Binary files /dev/null and b/Faz_Wrench/faz_sounds/1_start.wav differ diff --git a/Faz_Wrench/faz_sounds/2_puzzle-up.wav b/Faz_Wrench/faz_sounds/2_puzzle-up.wav new file mode 100644 index 000000000..57f41e134 Binary files /dev/null and b/Faz_Wrench/faz_sounds/2_puzzle-up.wav differ diff --git a/Faz_Wrench/faz_sounds/3_puzzle-down.wav b/Faz_Wrench/faz_sounds/3_puzzle-down.wav new file mode 100644 index 000000000..ef6322c9c Binary files /dev/null and b/Faz_Wrench/faz_sounds/3_puzzle-down.wav differ diff --git a/Faz_Wrench/faz_sounds/4_unlocked.wav b/Faz_Wrench/faz_sounds/4_unlocked.wav new file mode 100644 index 000000000..aced3e11f Binary files /dev/null and b/Faz_Wrench/faz_sounds/4_unlocked.wav differ diff --git a/FunHouse_Arduino_Demos/rainbow/rainbow.ino b/FunHouse_Arduino_Demos/rainbow/rainbow.ino index 5bd0d7eb1..f10b2a1bf 100644 --- a/FunHouse_Arduino_Demos/rainbow/rainbow.ino +++ b/FunHouse_Arduino_Demos/rainbow/rainbow.ino @@ -14,24 +14,31 @@ uint8_t LED_dutycycle = 0; void setup() { Serial.begin(115200); - + pinMode(LED_BUILTIN, OUTPUT); - + +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 1, 1) + ledcAttach(LED_BUILTIN, 5000, 8); +#else ledcSetup(0, 5000, 8); ledcAttachPin(LED_BUILTIN, 0); - +#endif + pixels.begin(); // Initialize pins for output pixels.show(); // Turn all LEDs off ASAP pixels.setBrightness(20); } - void loop() { Serial.println("Hello!"); // pulse red LED +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 1, 1) + ledcWrite(LED_BUILTIN, LED_dutycycle++); +#else ledcWrite(0, LED_dutycycle++); +#endif // rainbow dotstars for (int i=0; i= ESP_IDF_VERSION_VAL(5, 1, 1) + ledcAttach(LED_BUILTIN, 2000, 8); + ledcAttach(SPEAKER, 2000, 8); + ledcWrite(SPEAKER, 0); +#else ledcSetup(0, 2000, 8); ledcAttachPin(LED_BUILTIN, 0); ledcSetup(1, 2000, 8); ledcAttachPin(SPEAKER, 1); ledcWrite(1, 0); +#endif } @@ -94,11 +100,11 @@ void loop() { /********************* sensors */ sensors_event_t humidity, temp, pressure; - + tft.setCursor(0, 0); tft.setTextColor(ST77XX_YELLOW, BG_COLOR); dps.getEvents(&temp, &pressure); - + tft.print("DP310: "); tft.print(temp.temperature, 0); tft.print(" C "); @@ -125,7 +131,7 @@ void loop() { tft.setCursor(0, 40); tft.setTextColor(ST77XX_YELLOW); tft.print("Buttons: "); - if (! digitalRead(BUTTON_DOWN)) { + if (! digitalRead(BUTTON_DOWN)) { tft.setTextColor(ST77XX_GREY); } else { Serial.println("DOWN pressed"); @@ -133,15 +139,15 @@ void loop() { } tft.print("DOWN "); - if (! digitalRead(BUTTON_SELECT)) { + if (! digitalRead(BUTTON_SELECT)) { tft.setTextColor(ST77XX_GREY); } else { Serial.println("SELECT pressed"); tft.setTextColor(ST77XX_WHITE); } tft.print("SEL "); - - if (! digitalRead(BUTTON_UP)) { + + if (! digitalRead(BUTTON_UP)) { tft.setTextColor(ST77XX_GREY); } else { Serial.println("UP pressed"); @@ -151,12 +157,12 @@ void loop() { /************************** CAPACITIVE */ uint16_t touchread; - + tft.setCursor(0, 60); tft.setTextColor(ST77XX_YELLOW, BG_COLOR); tft.print("Captouch 6: "); touchread = touchRead(6); - if (touchread < 10000 ) { + if (touchread < 10000 ) { tft.setTextColor(ST77XX_GREY, BG_COLOR); } else { tft.setTextColor(ST77XX_WHITE, BG_COLOR); @@ -164,12 +170,12 @@ void loop() { tft.print(touchread); tft.println(" "); Serial.printf("Captouch #6 reading: %d\n", touchread); - + tft.setCursor(0, 80); tft.setTextColor(ST77XX_YELLOW, BG_COLOR); tft.print("Captouch 7: "); touchread = touchRead(7); - if (touchread < 20000 ) { + if (touchread < 20000 ) { tft.setTextColor(ST77XX_GREY, BG_COLOR); } else { tft.setTextColor(ST77XX_WHITE, BG_COLOR); @@ -183,7 +189,7 @@ void loop() { tft.setTextColor(ST77XX_YELLOW, BG_COLOR); tft.print("Captouch 8: "); touchread = touchRead(8); - if (touchread < 20000 ) { + if (touchread < 20000 ) { tft.setTextColor(ST77XX_GREY, BG_COLOR); } else { tft.setTextColor(ST77XX_WHITE, BG_COLOR); @@ -200,7 +206,7 @@ void loop() { tft.setTextColor(ST77XX_YELLOW, BG_COLOR); tft.print("Analog 0: "); analogread = analogRead(A0); - if (analogread < 8000 ) { + if (analogread < 8000 ) { tft.setTextColor(ST77XX_WHITE, BG_COLOR); } else { tft.setTextColor(ST77XX_RED, BG_COLOR); @@ -214,7 +220,7 @@ void loop() { tft.setTextColor(ST77XX_YELLOW, BG_COLOR); tft.print("Analog 1: "); analogread = analogRead(A1); - if (analogread < 8000 ) { + if (analogread < 8000 ) { tft.setTextColor(ST77XX_WHITE, BG_COLOR); } else { tft.setTextColor(ST77XX_RED, BG_COLOR); @@ -223,12 +229,12 @@ void loop() { tft.println(" "); Serial.printf("Analog A1 reading: %d\n", analogread); - + tft.setCursor(0, 160); tft.setTextColor(ST77XX_YELLOW, BG_COLOR); tft.print("Analog 2: "); analogread = analogRead(A2); - if (analogread < 8000 ) { + if (analogread < 8000 ) { tft.setTextColor(ST77XX_WHITE, BG_COLOR); } else { tft.setTextColor(ST77XX_RED, BG_COLOR); @@ -245,21 +251,25 @@ void loop() { tft.print(analogread); tft.println(" "); Serial.printf("Light sensor reading: %d\n", analogread); - + /************************** Beep! */ - if (digitalRead(BUTTON_SELECT)) { + if (digitalRead(BUTTON_SELECT)) { Serial.println("** Beep! ***"); fhtone(SPEAKER, 988.0, 100.0); // tone1 - B5 fhtone(SPEAKER, 1319.0, 200.0); // tone2 - E6 delay(100); //fhtone(SPEAKER, 2000.0, 100.0); } - + /************************** LEDs */ // pulse red LED +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 1, 1) + ledcWrite(LED_BUILTIN, LED_dutycycle); +#else ledcWrite(0, LED_dutycycle); +#endif LED_dutycycle += 32; - + // rainbow dotstars for (int i=0; i= ESP_IDF_VERSION_VAL(5, 1, 1) + ledcAttach(SPEAKER, frequency, 8); + ledcWrite(SPEAKER, 128); + delay(duration); + ledcWrite(SPEAKER, 0); +#else ledcSetup(1, frequency, 8); ledcAttachPin(pin, 1); ledcWrite(1, 128); delay(duration); ledcWrite(1, 0); +#endif } diff --git a/FunHouse_Arduino_Demos/shipping_demo/shipping_demo.ino b/FunHouse_Arduino_Demos/shipping_demo/shipping_demo.ino index 93257d664..21d2e75a8 100644 --- a/FunHouse_Arduino_Demos/shipping_demo/shipping_demo.ino +++ b/FunHouse_Arduino_Demos/shipping_demo/shipping_demo.ino @@ -26,7 +26,7 @@ uint16_t firstPixelHue = 0; void setup() { Serial.begin(115200); delay(100); - + pixels.begin(); // Initialize pins for output pixels.show(); // Turn all LEDs off ASAP pixels.setBrightness(20); @@ -36,7 +36,7 @@ void setup() { pinMode(BUTTON_UP, INPUT_PULLDOWN); //analogReadResolution(13); - + tft.init(240, 240); // Initialize ST7789 screen pinMode(TFT_BACKLIGHT, OUTPUT); digitalWrite(TFT_BACKLIGHT, HIGH); // Backlight on @@ -51,8 +51,8 @@ void setup() { tft.setTextColor(ST77XX_YELLOW); tft.print("DP310? "); - - if (! dps.begin_I2C()) { + + if (! dps.begin_I2C()) { tft.setTextColor(ST77XX_RED); tft.println("FAIL!"); while (1) delay(100); @@ -66,8 +66,8 @@ void setup() { tft.setCursor(0, 20); tft.setTextColor(ST77XX_YELLOW); tft.print("AHT20? "); - - if (! aht.begin()) { + + if (! aht.begin()) { tft.setTextColor(ST77XX_RED); tft.println("FAIL!"); while (1) delay(100); @@ -78,12 +78,18 @@ void setup() { pinMode(LED_BUILTIN, OUTPUT); pinMode(SPEAKER, OUTPUT); +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 1, 1) + ledcAttach(LED_BUILTIN, 2000, 8); + ledcAttach(SPEAKER, 2000, 8); + ledcWrite(SPEAKER, 0); +#else ledcSetup(0, 2000 * 80, 8); ledcAttachPin(LED_BUILTIN, 0); ledcSetup(1, 2000 * 80, 8); ledcAttachPin(SPEAKER, 1); ledcWrite(1, 0); +#endif } @@ -93,11 +99,11 @@ void loop() { /********************* sensors */ sensors_event_t humidity, temp, pressure; - + tft.setCursor(0, 0); tft.setTextColor(ST77XX_YELLOW, BG_COLOR); dps.getEvents(&temp, &pressure); - + tft.print("DP310: "); tft.print(temp.temperature, 0); tft.print(" C "); @@ -124,7 +130,7 @@ void loop() { tft.setCursor(0, 40); tft.setTextColor(ST77XX_YELLOW); tft.print("Buttons: "); - if (! digitalRead(BUTTON_DOWN)) { + if (! digitalRead(BUTTON_DOWN)) { tft.setTextColor(ST77XX_GREY); } else { Serial.println("DOWN pressed"); @@ -132,15 +138,15 @@ void loop() { } tft.print("DOWN "); - if (! digitalRead(BUTTON_SELECT)) { + if (! digitalRead(BUTTON_SELECT)) { tft.setTextColor(ST77XX_GREY); } else { Serial.println("SELECT pressed"); tft.setTextColor(ST77XX_WHITE); } tft.print("SEL "); - - if (! digitalRead(BUTTON_UP)) { + + if (! digitalRead(BUTTON_UP)) { tft.setTextColor(ST77XX_GREY); } else { Serial.println("UP pressed"); @@ -150,12 +156,12 @@ void loop() { /************************** CAPACITIVE */ uint16_t touchread; - + tft.setCursor(0, 60); tft.setTextColor(ST77XX_YELLOW, BG_COLOR); tft.print("Captouch 6: "); touchread = touchRead(6); - if (touchread < 10000 ) { + if (touchread < 10000 ) { tft.setTextColor(ST77XX_GREY, BG_COLOR); } else { tft.setTextColor(ST77XX_WHITE, BG_COLOR); @@ -163,12 +169,12 @@ void loop() { tft.print(touchread); tft.println(" "); Serial.printf("Captouch #6 reading: %d\n", touchread); - + tft.setCursor(0, 80); tft.setTextColor(ST77XX_YELLOW, BG_COLOR); tft.print("Captouch 7: "); touchread = touchRead(7); - if (touchread < 20000 ) { + if (touchread < 20000 ) { tft.setTextColor(ST77XX_GREY, BG_COLOR); } else { tft.setTextColor(ST77XX_WHITE, BG_COLOR); @@ -182,7 +188,7 @@ void loop() { tft.setTextColor(ST77XX_YELLOW, BG_COLOR); tft.print("Captouch 8: "); touchread = touchRead(8); - if (touchread < 20000 ) { + if (touchread < 20000 ) { tft.setTextColor(ST77XX_GREY, BG_COLOR); } else { tft.setTextColor(ST77XX_WHITE, BG_COLOR); @@ -199,7 +205,7 @@ void loop() { tft.setTextColor(ST77XX_YELLOW, BG_COLOR); tft.print("Analog 0: "); analogread = analogRead(A0); - if (analogread < 8000 ) { + if (analogread < 8000 ) { tft.setTextColor(ST77XX_WHITE, BG_COLOR); } else { tft.setTextColor(ST77XX_RED, BG_COLOR); @@ -213,7 +219,7 @@ void loop() { tft.setTextColor(ST77XX_YELLOW, BG_COLOR); tft.print("Analog 1: "); analogread = analogRead(A1); - if (analogread < 8000 ) { + if (analogread < 8000 ) { tft.setTextColor(ST77XX_WHITE, BG_COLOR); } else { tft.setTextColor(ST77XX_RED, BG_COLOR); @@ -222,12 +228,12 @@ void loop() { tft.println(" "); Serial.printf("Analog A1 reading: %d\n", analogread); - + tft.setCursor(0, 160); tft.setTextColor(ST77XX_YELLOW, BG_COLOR); tft.print("Analog 2: "); analogread = analogRead(A2); - if (analogread < 8000 ) { + if (analogread < 8000 ) { tft.setTextColor(ST77XX_WHITE, BG_COLOR); } else { tft.setTextColor(ST77XX_RED, BG_COLOR); @@ -244,21 +250,25 @@ void loop() { tft.print(analogread); tft.println(" "); Serial.printf("Light sensor reading: %d\n", analogread); - + /************************** Beep! */ - if (digitalRead(BUTTON_SELECT)) { + if (digitalRead(BUTTON_SELECT)) { Serial.println("** Beep! ***"); fhtone(SPEAKER, 988.0, 100.0); // tone1 - B5 fhtone(SPEAKER, 1319.0, 200.0); // tone2 - E6 delay(100); //fhtone(SPEAKER, 2000.0, 100.0); } - + /************************** LEDs */ // pulse red LED +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 1, 1) + ledcWrite(LED_BUILTIN, LED_dutycycle); +#else ledcWrite(0, LED_dutycycle); +#endif LED_dutycycle += 32; - + // rainbow dotstars for (int i=0; i= ESP_IDF_VERSION_VAL(5, 1, 1) + ledcAttach(SPEAKER, frequecy, 8); + ledcWrite(SPEAKER, 128); + delay(duration); + ledcWrite(SPEAKER, 0); +#else ledcSetup(1, frequecy * 80, 8); ledcAttachPin(pin, 1); ledcWrite(1, 128); delay(duration); ledcWrite(1, 0); +#endif }