实验的视频记录(1分09秒)
https://v.youku.com/v_show/id_XNTg5ODkzNTk3Mg==.html?spm=a2hcb.playlsit.page.1
【花雕动手做】有趣好玩的音乐可视化系列小项目(20)--首饰盒镜子灯
项目程序之二:音乐反应节奏灯
模块接线:WS2812B接D6
MAX4466 UNO
VCC 5V
GND GND
OUT D7
/*
【花雕动手做】有趣好玩的音乐可视化系列小项目(20)--首饰盒镜子灯
项目程序之二:音乐反应节奏灯
模块接线:WS2812B接D6
MAX4466 UNO
VCC 5V
GND GND
OUT D7
*/
#include<FastLED.h>
#define LED_PIN 6
#define NUM_LEDS 21
CRGB leds[NUM_LEDS];
uint8_t hue = 0;
int soundsensor = 7;
void setup() {
delay(2000);
FastLED.addLeds<WS2812B, LED_PIN, GRB>(leds, NUM_LEDS);
FastLED.setBrightness(155);
pinMode(soundsensor, INPUT);
}
void loop() {
int sensval = digitalRead(soundsensor);
if (sensval == 1) {
leds[0] = CRGB :: Red;
fill_solid(leds, NUM_LEDS, CRGB :: Blue);
rainbow_moving();
FastLED.show();
delay(10);
}
else {
leds[0] = CRGB :: Black;
fill_solid(leds, NUM_LEDS, CRGB :: Black);
FastLED.show();
delay(10);
}
}
void rainbow_moving() {
for (int i = 0; i < NUM_LEDS; i++) {
leds[i] = CHSV(hue + (i * 10), 255, 255);
}
EVERY_N_MILLISECONDS(10) {
hue++;
}
}
实验的视频记录(3分41秒)
https://v.youku.com/v_show/id_XNTg5NzYwMzY5Ng==.html?spm=a2hcb.playlsit.page.1
【花雕动手做】有趣好玩的音乐可视化系列小项目(20)--首饰盒镜子灯
项目程序之三:多彩MegunoLink伸缩音乐节拍灯
模块接线:WS2812B接D6
MAX4466 UNO
VCC 5V
GND GND
OUT A0
/*
【花雕动手做】有趣好玩的音乐可视化系列小项目(20)--首饰盒镜子灯
项目程序之三:多彩MegunoLink伸缩音乐节拍灯
模块接线:WS2812B接D6
MAX4466 UNO
VCC 5V
GND GND
OUT A0
*/
#include<FastLED.h>
#include<MegunoLink.h>
#include<Filter.h>
#define N_PIXELS 21
#define MIC_PIN A0
#define LED_PIN 6
#define NOISE 10
#define TOP (N_PIXELS+2)
#define LED_TYPE WS2811
#define BRIGHTNESS 10
#define COLOR_ORDER GRB
CRGB leds[N_PIXELS];
int lvl = 0, minLvl = 0, maxLvl = 10;
ExponentialFilter<long> ADCFilter(5, 0);
void setup() {
FastLED.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, N_PIXELS).setCorrection(TypicalLEDStrip);
FastLED.setBrightness(BRIGHTNESS);
}
void loop() {
int n, height;
n = analogRead(MIC_PIN);
n = abs(1023 - n);
n = (n <= NOISE) ? 0 : abs(n - NOISE);
ADCFilter.Filter(n);
lvl = ADCFilter.Current();
// Serial.print(n);
// Serial.print(" ");
// Serial.println(lvl);
height = TOP * (lvl - minLvl) / (long)(maxLvl - minLvl);
if (height < 0L) height = 0;
else if (height > TOP) height = TOP;
for (uint8_t i = 0; i < N_PIXELS; i++) {
if (i >= height) leds[i] = CRGB(0, 0, 0);
else leds[i] = Wheel( map( i, 0, N_PIXELS - 1, 30, 150 ) );
}
FastLED.show();
}
CRGB Wheel(byte WheelPos) {
if (WheelPos < 85)
return CRGB(WheelPos * 3, 255 - WheelPos * 3, 0);
else if (WheelPos < 170) {
WheelPos -= 85;
return CRGB(255 - WheelPos * 3, 0, WheelPos * 3);
} else {
WheelPos -= 170;
return CRGB(0, WheelPos * 3, 255 - WheelPos * 3);
}
}
实验的视频记录(3分36秒)
https://v.youku.com/v_show/id_XNTg5OTA5MjY2MA==.html?spm=a2hcb.playlsit.page.3
实验的视频记录(2分29秒)
https://v.youku.com/v_show/id_XNTg5NzY3NTMyNA==.html?spm=a2hcb.playlsit.page.1
引用: freebsder 发表于 2022-8-30 18:59 这是要送人?
音乐可视化的系列小实验,现在正在做第21项——CD光盘灯.......
引用: eagler8 发表于 2022-8-30 20:10 音乐可视化的系列小实验,现在正在做第21项——CD光盘灯.......
你这一个一个模块的,是要做什么大系统吗?
引用: freebsder 发表于 2022-8-31 12:50 你这一个一个模块的,是要做什么大系统吗?
偶然想法,音乐可视化,这个专题做了快一年了,给自己一个机会,尝试动动头脑,练习做做手工.....
挺有创意的,点个赞
实验的视频记录
优酷:https://v.youku.com/v_show/id_XNTkwNjY0MjM2NA==.html?spm=a2hcb.playlsit.page.1
B站:https://www.bilibili.com/video/BV1DW4y1Y7hn/?vd_source=98c6b1fc23b2787403d97f8d3cc0b7e5