找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 14056|回复: 3
打印 上一主题 下一主题
收起左侧

关于Arduino UNO板控制LED灯带颜色等问题,需要用什么样的LED

[复制链接]
跳转到指定楼层
楼主
Arduino UNO板怎样才能控制灯带?目的是要控制灯带的颜色以及只让某几个灯亮,新人在论坛上看到的一个魔幻音乐盒想做一下,但是不知道要用什么样的LED,百度了一下是要LED三线的,但还是不懂,希望大神们指点一下。

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 顶 踩
回复

使用道具 举报

沙发
ID:310519 发表于 2018-9-6 20:04 | 只看该作者
首先要了解一下LED色彩。

通过调整红色,绿色,蓝色LED的亮度,就可以得到不同的颜色。

有一种IC是专门驱动三色LED的,可以级联,通过接收亮度数据发出你想要的颜色。



回复

使用道具 举报

板凳
ID:155507 发表于 2018-9-6 22:00 | 只看该作者
WS2812灯带
WS2812内置IC灯条; 说白了就是将驱动IC的主要部分集成到了平常使用的5050RGB贴片灯珠里面。他的好处在于将电路都集成到了灯珠里面,外部的电路都可以省略掉,这样就减少了线路设计,减少了外部元器件,减少了体积,减少了故障率,减少了生产成本

0b55b319ebc4b745f8d3b888c7fc1e178b8215ec.jpg (12.86 KB, 下载次数: 92)

0b55b319ebc4b745f8d3b888c7fc1e178b8215ec.jpg

9358d109b3de9c82b5cef7116481800a18d84380.jpg (32.8 KB, 下载次数: 45)

9358d109b3de9c82b5cef7116481800a18d84380.jpg

d058ccbf6c81800a70988690b93533fa828b472a.jpg (42.63 KB, 下载次数: 51)

d058ccbf6c81800a70988690b93533fa828b472a.jpg
回复

使用道具 举报

地板
ID:155507 发表于 2018-9-6 22:22 | 只看该作者


  1. // NeoPixel Ring simple sketch (c) 2013 Shae Erisson
  2. // released under the GPLv3 license to match the rest of the AdaFruit NeoPixel library

  3. #include <Adafruit_NeoPixel.h>
  4. #ifdef __AVR__
  5.   #include <avr/power.h>
  6. #endif

  7. // Which pin on the Arduino is connected to the NeoPixels?
  8. // On a Trinket or Gemma we suggest changing this to 1
  9. #define PIN            6

  10. // How many NeoPixels are attached to the Arduino?
  11. #define NUMPIXELS      16

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

  16. int delayval = 500; // delay for half a second

  17. void setup() {
  18.   // This is for Trinket 5V 16MHz, you can remove these three lines if you are not using a Trinket
  19. #if defined (__AVR_ATtiny85__)
  20.   if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
  21. #endif
  22.   // End of trinket special code

  23.   pixels.begin(); // This initializes the NeoPixel library.
  24. }

  25. void loop() {

  26.   // For a set of NeoPixels the first NeoPixel is 0, second is 1, all the way up to the count of pixels minus one.

  27.   for(int i=0;i<NUMPIXELS;i++){

  28.     // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
  29.     pixels.setPixelColor(i, pixels.Color(0,150,0)); // Moderately bright green color.

  30.     pixels.show(); // This sends the updated pixel color to the hardware.

  31.     delay(delayval); // Delay for a period of time (in milliseconds).

  32.   }
  33. }
复制代码
回复

使用道具 举报

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

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表