Your Exclusive Creation Backend

头像
BY tonylabs
#292
使用 RGB LED 时,请注意将 D6 拉高,为 RGB LED 供电,默认 D6 为拉低,省电。
代码: 全选
#include "MC20_Arduino_Interface.h"
#include <Adafruit_NeoPixel.h>

#define RGB_PWR      6
#define RGBPIN       10
#define LED_NUM      1

Adafruit_NeoPixel pixels = Adafruit_NeoPixel(LED_NUM, RGBPIN, NEO_GRB + NEO_KHZ800);

void setup()
{
  pixels.begin(); // This initializes the NeoPixel library.
  pinMode(RGB_PWR, OUTPUT);
  digitalWrite(RGB_PWR, HIGH);
}

void loop()
{
  pixels.setPixelColor(0, pixels.Color(0,0,100)); // Moderately bright blue color.
  pixels.show(); // This sends the updated pixel color to the hardware.
  delay(1000);   // Wait for 1 second
  pixels.setPixelColor(0, pixels.Color(0,0,0));   // Turn off the led.
  pixels.show(); 
  delay(1000); 
}

BOM Manager