找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 14413|回復: 3
打印 上一主題 下一主題
收起左側

關于Arduino UNO板控制LED燈帶顏色等問題,需要用什么樣的LED

[復制鏈接]
跳轉到指定樓層
樓主
ID:393422 發(fā)表于 2018-9-4 11:37 | 只看該作者 |只看大圖 回帖獎勵 |倒序瀏覽 |閱讀模式
Arduino UNO板怎樣才能控制燈帶?目的是要控制燈帶的顏色以及只讓某幾個燈亮,新人在論壇上看到的一個魔幻音樂盒想做一下,但是不知道要用什么樣的LED,百度了一下是要LED三線的,但還是不懂,希望大神們指點一下。

分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享淘帖 頂 踩
回復

使用道具 舉報

沙發(fā)
ID:310519 發(fā)表于 2018-9-6 20:04 | 只看該作者
首先要了解一下LED色彩。

通過調(diào)整紅色,綠色,藍色LED的亮度,就可以得到不同的顏色。

有一種IC是專門驅(qū)動三色LED的,可以級聯(lián),通過接收亮度數(shù)據(jù)發(fā)出你想要的顏色。



回復

使用道具 舉報

板凳
ID:155507 發(fā)表于 2018-9-6 22:00 | 只看該作者
WS2812燈帶
WS2812內(nèi)置IC燈條; 說白了就是將驅(qū)動IC的主要部分集成到了平常使用的5050RGB貼片燈珠里面。他的好處在于將電路都集成到了燈珠里面,外部的電路都可以省略掉,這樣就減少了線路設計,減少了外部元器件,減少了體積,減少了故障率,減少了生產(chǎn)成本

0b55b319ebc4b745f8d3b888c7fc1e178b8215ec.jpg (12.86 KB, 下載次數(shù): 95)

0b55b319ebc4b745f8d3b888c7fc1e178b8215ec.jpg

9358d109b3de9c82b5cef7116481800a18d84380.jpg (32.8 KB, 下載次數(shù): 49)

9358d109b3de9c82b5cef7116481800a18d84380.jpg

d058ccbf6c81800a70988690b93533fa828b472a.jpg (42.63 KB, 下載次數(shù): 56)

d058ccbf6c81800a70988690b93533fa828b472a.jpg
回復

使用道具 舉報

地板
ID:155507 發(fā)表于 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. }
復制代碼
回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規(guī)則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網(wǎng)

快速回復 返回頂部 返回列表