標(biāo)題: 關(guān)于Arduino UNO板控制LED燈帶顏色等問題,需要用什么樣的LED [打印本頁(yè)]

作者: liuchangshuo    時(shí)間: 2018-9-4 11:37
標(biāo)題: 關(guān)于Arduino UNO板控制LED燈帶顏色等問題,需要用什么樣的LED
Arduino UNO板怎樣才能控制燈帶?目的是要控制燈帶的顏色以及只讓某幾個(gè)燈亮,新人在論壇上看到的一個(gè)魔幻音樂盒想做一下,但是不知道要用什么樣的LED,百度了一下是要LED三線的,但還是不懂,希望大神們指點(diǎn)一下。


作者: diy1997    時(shí)間: 2018-9-6 20:04
首先要了解一下LED色彩。

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

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




作者: angmall    時(shí)間: 2018-9-6 22:00
WS2812燈帶
WS2812內(nèi)置IC燈條; 說白了就是將驅(qū)動(dòng)IC的主要部分集成到了平常使用的5050RGB貼片燈珠里面。他的好處在于將電路都集成到了燈珠里面,外部的電路都可以省略掉,這樣就減少了線路設(shè)計(jì),減少了外部元器件,減少了體積,減少了故障率,減少了生產(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

作者: angmall    時(shí)間: 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. }
復(fù)制代碼





歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1