用Arduino编程RGB LED

时间:2017-03-02 18:16:52

标签: arduino rgb led

我们正在尝试使用arduino UNO对具有数字输入的RGB LED条进行编码。我们的代码会验证,但是当我们上传时,我们会收到很多“在...中找到无效的库”

我们只是尝试从instructables上传示例代码,这就是它的样子:

/*  Arduino Tutorial - How to use an RGB LED Strip
  Dev: Michalis Vasilakis // Date 3/6/2016 // Ver 1.0
  Info: www.ardumotive.com                */

//Library
#include <Adafruit_NeoPixel.h>

//Constants
const int dinPin = 4;    // Din pin to Arduino pin 4
const int numOfLeds = 8; // Number of leds

Adafruit_NeoPixel pixels = Adafruit_NeoPixel(numOfLeds, dinPin, NEO_GRB + NEO_KHZ800);

// Color takes RGB values, from 0,0,0 up to 255,255,255
// e.g. White = (255,255,255), Red = (255,0,0);
int red = 255;    //Value from 0(led-off) to 255(). 
int green = 00; 
int blue = 0;


void setup() {
  pixels.begin(); // Initializes the NeoPixel library
  pixels.setBrightness(80); // Value from 0 to 100%
}

void loop() {
  // For a set of NeoPixels the first NeoPixel is 0, second is 1, all the way up to the count of pixels minus one.
  for(int i=0;i<numOfLeds;i++){
    pixels.setPixelColor(i, pixels.Color(red,green,blue)); 
    pixels.show(); // This sends the updated pixel color to the hardware.
    delay(10);   // Delay for a period of time to change the next led
  }
}

我们的LED没有点亮,我们已经更新了所有库,我们的IDE是1.8.1版,而我们的主板仍然没有。有谁知道为什么?

0 个答案:

没有答案