3386

帖子

0

TA的资源

五彩晶圆(中级)

21
 

  【花雕动手做】有趣好玩的音乐可视化系列小项目(22)--LED无限魔方
  项目程序之一:循环LED绿色LED快闪测试

 

/*
  【花雕动手做】有趣好玩的音乐可视化系列小项目(22)--LED无限魔方
  项目程序之一:循环LED绿色LED快闪测试
*/

#include <Adafruit_NeoPixel.h>

#define PIN 6
#define MAX_LED 35

#define ADD true
#define SUB false

int val = 0;
boolean stat = ADD;

Adafruit_NeoPixel strip = Adafruit_NeoPixel( MAX_LED, PIN, NEO_RGB + NEO_KHZ800 );

void setup() {
  strip.begin();
  strip.show();
}

void loop() {
  uint8_t i, a = 0;
  uint32_t color = strip.Color(255, 0, 0);
  while (a < 36)
  {
    for (i = 0; i < 35; i++)
    {
      if (i == a) strip.setPixelColor(i, color);
      else strip.setPixelColor(i, 0);
    }
    strip.show();
    delay(100);
    a++;
  }
}

 

 

回复

3386

帖子

0

TA的资源

五彩晶圆(中级)

22
 
 

回复

3386

帖子

0

TA的资源

五彩晶圆(中级)

23
 

发的帖子丢失了

 
 
 

回复

3386

帖子

0

TA的资源

五彩晶圆(中级)

24
 

发的贴子,不见了,只好重新再发一次

 
 
 

回复

3386

帖子

0

TA的资源

五彩晶圆(中级)

25
 

  【花雕动手做】有趣好玩的音乐可视化系列小项目(22)--LED无限魔方
  项目程序之一:循环LED绿色LED快闪测试

 

/*
  【花雕动手做】有趣好玩的音乐可视化系列小项目(22)--LED无限魔方
  项目程序之一:循环LED绿色LED快闪测试
*/

#include <Adafruit_NeoPixel.h>

#define PIN 6
#define MAX_LED 35

#define ADD true
#define SUB false

int val = 0;
boolean stat = ADD;

Adafruit_NeoPixel strip = Adafruit_NeoPixel( MAX_LED, PIN, NEO_RGB + NEO_KHZ800 );

void setup() {
  strip.begin();
  strip.show();
}

void loop() {
  uint8_t i, a = 0;
  uint32_t color = strip.Color(255, 0, 0);
  while (a < 36)
  {
    for (i = 0; i < 35; i++)
    {
      if (i == a) strip.setPixelColor(i, color);
      else strip.setPixelColor(i, 0);
    }
    strip.show();
    delay(100);
    a++;
  }
}

 

 
 
 

回复

1660

帖子

0

TA的资源

五彩晶圆(初级)

26
 

加油,坐等大作完成

点评

谢谢鼓励  详情 回复 发表于 2022-9-5 05:00
 
 
 

回复

1万

帖子

203

TA的资源

管理员

27
 

确实没看到sevens7的回帖。我给你去回收站查一下。

加EE小助手好友,
入技术交流群
EE服务号
精彩活动e手掌握
EE订阅号
热门资讯e网打尽
聚焦汽车电子软硬件开发
认真关注技术本身

点评

可以看到了  详情 回复 发表于 2022-9-5 05:00
个人签名玩板看这里:
https://bbs.eeworld.com.cn/elecplay.html
EEWorld测评频道众多好板等你来玩,还可以来频道许愿树许愿说说你想要玩的板子,我们都在努力为大家实现!
 
 
 

回复

272

帖子

0

TA的资源

一粒金砂(中级)

28
 

这是手把手教学了

点评

谢谢鼓励,都是小实验的记录。   第一回接触这项目,成不成也不知道,哪有可能教学,呵呵,尝试一下而已。  详情 回复 发表于 2022-9-5 05:04
 
 
 

回复

3386

帖子

0

TA的资源

五彩晶圆(中级)

29
 
本帖最后由 eagler8 于 2022-9-5 04:53 编辑

测试已安装的一部分

 

 
 
 

回复

3386

帖子

0

TA的资源

五彩晶圆(中级)

30
 

实验场景图  动态图

 

点击上图查看Gif动图

 
 
 

回复

3386

帖子

0

TA的资源

五彩晶圆(中级)

31
 
se7ens 发表于 2022-9-3 15:43 加油,坐等大作完成

谢谢鼓励

 
 
 

回复

3386

帖子

0

TA的资源

五彩晶圆(中级)

32
 
okhxyyo 发表于 2022-9-3 20:46 确实没看到sevens7的回帖。我给你去回收站查一下。

可以看到了

 
 
 

回复

3386

帖子

0

TA的资源

五彩晶圆(中级)

33
 
zxw1126 发表于 2022-9-4 10:20 这是手把手教学了

谢谢鼓励,都是小实验的记录。

 

第一回接触这项目,成不成也不知道,哪有可能教学,呵呵,尝试一下而已。

 
 
 

回复

3386

帖子

0

TA的资源

五彩晶圆(中级)

34
 
本帖最后由 eagler8 于 2022-9-5 05:21 编辑

多次失败,主要是涉及焊接点有大几十个(体积太小,老是接触不良),拆来拆去好几次,差点就放弃了,后来勉强点亮......

 

 
 
 

回复

3386

帖子

0

TA的资源

五彩晶圆(中级)

35
 

  【花雕动手做】有趣好玩的音乐可视化系列小项目(22)--LED无限魔方
  项目程序之二:NeoPixel Ring 绿色柱灯

 

/*
  【花雕动手做】有趣好玩的音乐可视化系列小项目(22)--LED无限魔方
  项目程序之二:NeoPixel Ring 绿色柱灯
*/

#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h> // Required for 16 MHz Adafruit Trinket
#endif

// Which pin on the Arduino is connected to the NeoPixels?
#define PIN        6 // On Trinket or Gemma, suggest changing this to 1

// How many NeoPixels are attached to the Arduino?
#define NUMPIXELS 60 // Popular NeoPixel ring size

// When setting up the NeoPixel library, we tell it how many pixels,
// and which pin to use to send signals. Note that for older NeoPixel
// strips you might need to change the third parameter -- see the
// strandtest example for more information on possible values.
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

#define DELAYVAL 500 // Time (in milliseconds) to pause between pixels

void setup() {
  // These lines are specifically to support the Adafruit Trinket 5V 16 MHz.
  // Any other board, you can remove this part (but no harm leaving it):
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
  clock_prescale_set(clock_div_1);
#endif
  // END of Trinket-specific code.
  pixels.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
}

void loop() {
  pixels.clear(); // Set all pixel colors to 'off'

  // The first NeoPixel in a strand is #0, second is 1, all the way up
  // to the count of pixels minus one.
  for (int i = 0; i < NUMPIXELS; i++) { // For each pixel...

    // pixels.Color() takes RGB values, from 0,0,0 up to 255,255,255
    // Here we're using a moderately bright green color:
    pixels.setPixelColor(i, pixels.Color(0, 250, 0));

    pixels.show();   // Send the updated pixel colors to the hardware.

    delay(100); // Pause before next pass through loop
  }
}

 

 
 
 

回复

3386

帖子

0

TA的资源

五彩晶圆(中级)

36
 

实验的视频记录(1分02秒)


https://v.youku.com/v_show/id_XNTkwMDM4ODA0NA==.html?spm=a2hcb.playlsit.page.1

 
 
 

回复

3386

帖子

0

TA的资源

五彩晶圆(中级)

37
 

实验场景图  动态图

 

点击上图查看Gif动图

 
 
 

回复

3386

帖子

0

TA的资源

五彩晶圆(中级)

38
 

  【花雕动手做】有趣好玩的音乐可视化系列小项目(22)--LED无限魔方
  项目程序之三:NeoPixel 测试程序

 

/*
  【花雕动手做】有趣好玩的音乐可视化系列小项目(22)--LED无限魔方
  项目程序之三:NeoPixel 测试程序
*/

#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h> // Required for 16 MHz Adafruit Trinket
#endif

// Which pin on the Arduino is connected to the NeoPixels?
// On a Trinket or Gemma we suggest changing this to 1:
#define LED_PIN    6

// How many NeoPixels are attached to the Arduino?
#define LED_COUNT 60

// Declare our NeoPixel strip object:
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
// Argument 1 = Number of pixels in NeoPixel strip
// Argument 2 = Arduino pin number (most are valid)
// Argument 3 = Pixel type flags, add together as needed:
//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
//   NEO_RGBW    Pixels are wired for RGBW bitstream (NeoPixel RGBW products)


// setup() function -- runs once at startup --------------------------------

void setup() {
  // These lines are specifically to support the Adafruit Trinket 5V 16 MHz.
  // Any other board, you can remove this part (but no harm leaving it):
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
  clock_prescale_set(clock_div_1);
#endif
  // END of Trinket-specific code.

  strip.begin();           // INITIALIZE NeoPixel strip object (REQUIRED)
  strip.show();            // Turn OFF all pixels ASAP
  strip.setBrightness(50); // Set BRIGHTNESS to about 1/5 (max = 255)
}


// loop() function -- runs repeatedly as long as board is on ---------------

void loop() {
  // Fill along the length of the strip in various colors...
  colorWipe(strip.Color(255,   0,   0), 50); // Red
  colorWipe(strip.Color(  0, 255,   0), 50); // Green
  colorWipe(strip.Color(  0,   0, 255), 50); // Blue

  // Do a theater marquee effect in various colors...
  theaterChase(strip.Color(127, 127, 127), 50); // White, half brightness
  theaterChase(strip.Color(127,   0,   0), 50); // Red, half brightness
  theaterChase(strip.Color(  0,   0, 127), 50); // Blue, half brightness

  rainbow(10);             // Flowing rainbow cycle along the whole strip
  theaterChaseRainbow(50); // Rainbow-enhanced theaterChase variant
}


// Some functions of our own for creating animated effects -----------------

// Fill strip pixels one after another with a color. Strip is NOT cleared
// first; anything there will be covered pixel by pixel. Pass in color
// (as a single 'packed' 32-bit value, which you can get by calling
// strip.Color(red, green, blue) as shown in the loop() function above),
// and a delay time (in milliseconds) between pixels.
void colorWipe(uint32_t color, int wait) {
  for (int i = 0; i < strip.numPixels(); i++) { // For each pixel in strip...
    strip.setPixelColor(i, color);         //  Set pixel's color (in RAM)
    strip.show();                          //  Update strip to match
    delay(wait);                           //  Pause for a moment
  }
}

// Theater-marquee-style chasing lights. Pass in a color (32-bit value,
// a la strip.Color(r,g,b) as mentioned above), and a delay time (in ms)
// between frames.
void theaterChase(uint32_t color, int wait) {
  for (int a = 0; a < 10; a++) { // Repeat 10 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 steps of 3...
      for (int c = b; c < strip.numPixels(); c += 3) {
        strip.setPixelColor(c, color); // Set pixel 'c' to value 'color'
      }
      strip.show(); // Update strip with new contents
      delay(wait);  // Pause for a moment
    }
  }
}

// Rainbow cycle along whole strip. Pass delay time (in ms) between frames.
void rainbow(int wait) {
  // Hue of first pixel runs 5 complete loops through the color wheel.
  // Color wheel has a range of 65536 but it's OK if we roll over, so
  // just count from 0 to 5*65536. Adding 256 to firstPixelHue each time
  // means we'll make 5*65536/256 = 1280 passes through this outer loop:
  for (long firstPixelHue = 0; firstPixelHue < 5 * 65536; firstPixelHue += 256) {
    for (int i = 0; i < strip.numPixels(); i++) { // For each pixel in strip...
      // Offset pixel hue by an amount to make one full revolution of the
      // color wheel (range of 65536) along the length of the strip
      // (strip.numPixels() steps):
      int pixelHue = firstPixelHue + (i * 65536L / strip.numPixels());
      // strip.ColorHSV() can take 1 or 3 arguments: a hue (0 to 65535) or
      // optionally add saturation and value (brightness) (each 0 to 255).
      // Here we're using just the single-argument hue variant. The result
      // is passed through strip.gamma32() to provide 'truer' colors
      // before assigning to each pixel:
      strip.setPixelColor(i, strip.gamma32(strip.ColorHSV(pixelHue)));
    }
    strip.show(); // Update strip with new contents
    delay(wait);  // Pause for a moment
  }
}

// Rainbow-enhanced theater marquee. Pass delay time (in ms) between frames.
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
    }
  }
}

 

 
 
 

回复

3386

帖子

0

TA的资源

五彩晶圆(中级)

39
 

实验场景图  动态图

 

点击上图查看Gif动图

 
 
 

回复

3386

帖子

0

TA的资源

五彩晶圆(中级)

40
 

实验的视频记录(1分29秒)

https://v.youku.com/v_show/id_XN ... hcb.playlsit.page.1

 


 

 
 
 

回复
您需要登录后才可以回帖 登录 | 注册

查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/8 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表