처음 데이타 입력핀을 스파크 방지차원에서 500옴 정도되는 저항으로 연결하는게 좋다는군요.
입력되는 핀이 하나뿐이라 간단합니다. 6번핀에 연결하고 아래와 같이 하면 간단히 테스트가 가능합니다.
테스트차원에서 2개만 연결해서 각각 테스트 해봤습니다.
// NeoPixel Ring simple sketch (c) 2013 Shae Erisson// released under the GPLv3 license to match the rest of the AdaFruit NeoPixel library#include <Adafruit_NeoPixel.h>#ifdef __AVR__#include <avr/power.h>#endif// Which pin on the Arduino is connected to the NeoPixels?// On a Trinket or Gemma we suggest changing this to 1#define PIN 6// How many NeoPixels are attached to the Arduino?#define NUMPIXELS 2// When we setup the NeoPixel library, we tell it how many pixels, and which pin to use to send signals.// Note that for older NeoPixel strips you might need to change the third parameter--see the strandtest// example for more information on possible values.Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);int delayval = 1000; // delay for half a secondvoid setup() {pixels.begin(); // This initializes the NeoPixel library.pixels.setBrightness(64);}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<NUMPIXELS;i++){// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255pixels.setPixelColor(i, pixels.Color(0,250,0)); // Moderately bright green color.pixels.show(); // This sends the updated pixel color to the hardware.delay(delayval); // Delay for a period of time (in milliseconds).}}
댓글 없음:
댓글 쓰기