티스토리 뷰
소스 코드 (TestVer01.ino)
// 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> // Required for 16 MHz Adafruit Trinket
#endif
// Which pin on the Arduino is connected to the NeoPixels?
#define PIN 3 // On Trinket or Gemma, suggest changing this to 1
// How many NeoPixels are attached to the Arduino?
#define NUMPIXELS 6 // Popular NeoPixel ring size
// When setting up 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(NUMPIXELS, PIN, NEO_GRBW + NEO_KHZ800);
#define DELAYVAL 500 // Time (in milliseconds) to pause between pixels
void setup() {
// These lines are specifically to support the Adafruit Trinket 5V 16 MHz.
// Any other board, you can remove this part (but no harm leaving it):
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
clock_prescale_set(clock_div_1);
#endif
// END of Trinket-specific code.
pixels.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
}
void loop() {
pixels.clear(); // Set all pixel colors to 'off'
pixels.show();
delay(2000);
// The first NeoPixel in a strand is #0, second is 1, all the way up
// to the count of pixels minus one.
for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
// pixels.Color() takes RGB values, from 0,0,0 up to 255,255,255
// Here we're using a moderately bright green color:
pixels.setPixelColor(i, pixels.Color(250, 0, 0, 100));
pixels.show(); // Send the updated pixel colors to the hardware.
delay(DELAYVAL); // Pause before next pass through loop
}
}
네오픽셀 라이브러리
반응형
'SWDesk > Firmware' 카테고리의 다른 글
아두이노 나노 ESP32 - POST Request 예제 (0) | 2023.12.28 |
---|---|
아두이노 나노 ESP32 - GET Request 예제 (0) | 2023.12.27 |
I2C Communication with MCP4532 Potentiometer (0) | 2022.09.05 |
아두이노 SMS 전송 (0) | 2022.05.19 |
Control Code for 7-Segment (0) | 2022.02.25 |
반응형
250x250
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- Decorator
- badp
- Innovations&Hurdles
- 아두이노
- arduino
- BSC
- ServantClock
- Innovations
- 혁신
- 전압전류모니터링
- DYOV
- 둎
- 치매방지
- 혁신과허들
- 배프
- 전류
- image
- 티스토리챌린지
- Video
- 심심풀이치매방지기
- 오블완
- bilient
- 빌리언트
- Hurdles
- 치매
- 허들
- 심심풀이
- 절연형
- 전압
- Innovation&Hurdles
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
글 보관함