音乐灯带-接入ESPHome(2)——增加音乐效果及定制化
操作步骤
-
增加灯带的音乐效果
- 下载必要的源代码
- 修改配置文件
- UPLOAD
-
接入不同规格的灯带(APA102 30led灯带)
-
通过服务调用控制智能灯的显示模式
参考
-
下载命令参考
git clone https://github.com/zhujisheng/audio-reactive-led-strip cp audio-reactive-led-strip/music_leds_esphome.h ~/esphome_config/ cp -r audio-reactive-led-strip/includes/ ~/esphome_config/
注:如果是在SSH Add-on中运行,并且ESPHome也是以Add-on运行,请以/config/esphome/
替换第二、第三条命令中的目标地址~/esphome_config/
- ESPHome中配置FastLED Light
https://esphome.io/components/light/fastled.html
- 参考配置
```yaml esphome: name: esp32_music platform: ESP32 board: nodemcu-32s includes: - music_leds_esphome.h - includes/FFT.h - includes/ExpFilter.h - includes/VisualEffect.h - includes/gaussian_filter1d.h
……
light: - platform: fastled_clockless id: LedsStrip chipset: NEOPIXEL pin: GPIO21 num_leds: 60 name: "MUSIC LEDS" effects: - addressable_rainbow: - addressable_color_wipe: - addressable_scan: - addressable_twinkle: - addressable_random_twinkle: - addressable_fireworks: - addressable_flicker: - addressable_lambda: name: Scroll with Music update_interval: 0s lambda: |- music_leds.ShowFrame(MODE_SCROLL, &it); - addressable_lambda: name: Energy with Music update_interval: 0s lambda: |- music_leds.ShowFrame(MODE_ENERGY, &it); - addressable_lambda: name: Spectrum with Music update_interval: 0s lambda: |- music_leds.ShowFrame(MODE_SPECTRUM, &it); ```