我感觉我是一头猪
技术宅吧
全部回复
仅看楼主
level 14
破晓G子夜 楼主
2021年07月19日 14点07分 1
level 14
破晓G子夜 楼主
这莫一个破玩意我写了这莫半天
void loop() {
if(pos==0){
for(int i=0; i<=14; i++){
leds[i] = CRGB::Red;
FastLED.show();
delay(s);
}
for(int i=14; i>=1; i--){
leds[i] = CRGB::DarkBlue;
FastLED.show();
delay(s);
}
pos=pos+1;
}
if(pos==1){
for(int i=0; i<=14; i++){
leds[i] = CRGB::Purple;
FastLED.show();
delay(s);
}
for(int i=14; i>=1; i--){
leds[i] = CRGB::Green;
FastLED.show();
delay(s);
}
pos=pos-1;
}
}
2021年07月19日 14点07分 2
不做程序员,可以考虑图形化编程。
2021年07月19日 23点07分
@青岛银吧 其实都是一样的[滑稽]不会还是不会
2021年07月19日 23点07分
@破晓G子夜 绝对不一样。 图形化不纠缠于细节,简单通顺,一目了然。敲代码人机不友好,光那些“”;大小写就能劝退,莫名其妙的编译出错能把人逼疯。 推荐:米思齐。
2021年07月20日 00点07分
@青岛银吧 我都是这边写,另外班边屏幕就是代码函数
2021年07月20日 02点07分
level 14
破晓G子夜 楼主
#include <FastLED.h>
#define LED_PIN 2
#define NUM_LEDS 15
uint8_t max_bright = 115;
CRGB leds[NUM_LEDS];
int i;
int b;
void setup() {
FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);
}
void loop() {
for(b=0;b<=15;b++){
for (i = 0; i <= 225; i++) {
leds[b] = CRGB(115, i, 0);
FastLED.show();
delay(5);
}
delay(10);
for (i = 225; i >= 0; i--) {
leds[b] = CRGB(0, i, i);
FastLED.show();
delay(5);
}
delay(10);
}
for(b=15;b>=0;b--){
for (i = 0; i <= 225; i++) {
leds[b] = CRGB(i, 0, 0);
FastLED.show();
delay(5);
}
delay(100);
for (i = 225; i >= 0; i--) {
leds[b] = CRGB(0, i, 0);
FastLED.show();
delay(5);
}
delay(100);
}
}
2021年07月21日 06点07分 3
level 14
破晓G子夜 楼主
#include "FastLED.h" // 此示例程序需要使用FastLED库
#define NUM_LEDS 15 // LED灯珠数量
#define DATA_PIN 2 // Arduino输出控制信号引脚
#define LED_TYPE WS2812 // LED灯带型号
#define COLOR_ORDER GRB // RGB灯珠中红色、绿色、蓝色LED的排列顺序
uint8_t max_bright = 225; //228 LED亮度控制变量,可使用数值为 0 ~ 255, 数值越大则光带亮度越高
int i,b;
int s=0;
CRGB leds[NUM_LEDS]; // 建立光带leds
void setup() {
Serial.begin(9600); // 启动串行通讯
delay(100); // 稳定性等待
LEDS.addLeds<LED_TYPE, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS); // 初始化光带
FastLED.setBrightness(max_bright); // 设置光带亮度
}
void loop() {
for (int b = 0; b <= 14; b++) {
for (int i = 0; i <= 225; i=i+1) {
leds[b] = CRGB(i, 0, 0);
FastLED.show();
delay(s);
leds[b-1] = CRGB(0, 0, i);
FastLED.show();
delay(s);
leds[b-2] = CRGB(0, i, 0);
FastLED.show();
delay(s);
}
for (int i = 225; i >= 0; i=i-1) {
leds[b] = CRGB(i, 0, 0);
FastLED.show();
delay(s);
leds[b-1] = CRGB(0, 0, i);
FastLED.show();
delay(s);
leds[b-2] = CRGB(0, i, 0);
FastLED.show();
delay(s);
}
}
for (int b = 14; b >=0; b--) {
for (int i = 0; i <= 225; i=i+1) {
leds[b] = CRGB(0, i, i);
FastLED.show();
delay(s);
leds[b-1] = CRGB(i, i, 0);
FastLED.show();
delay(s);
leds[b-2] = CRGB(0, i, 0);
FastLED.show();
delay(s);
}
for (int i = 225; i >= 0; i=i-1) {
leds[b] = CRGB(0, i, i);
FastLED.show();
delay(s);
leds[b-1] = CRGB(i, i, 0);
FastLED.show();
delay(s);
leds[b-2] = CRGB(0, i, 0);
FastLED.show();
delay(s);
}
}
}
2021年07月21日 09点07分 4
level 11
阿巴阿巴
2021年07月29日 16点07分 6
阿巴阿巴阿巴
2021年07月30日 04点07分
level 10
[勉强]我知道你买的是什么,而且我知道这个有工具可以生成
2021年07月29日 16点07分 7
我买的的是ws2812但是你说话不是说有生成
2021年07月30日 04点07分
1