BASIC4MCU | 질문게시판 | 답변 : 아두이노 IDE 프로마이크로 네오픽셀
페이지 정보
작성자 master 작성일2024-09-29 11:39 조회76회 댓글0건본문
#include<Adafruit_NeoPixel.h>
#define ledPin 6
#define numLeds 8
Adafruit_NeoPixel strip(numLeds, ledPin, NEO_GRB + NEO_KHZ800);
//
int t0[16][3]={
{255,255,255},{0,0,0},{255, 0, 0),{0,0,0},{255,187, 0),{0,0,0},{255,228, 0),{0,0,0},
{ 29,219, 22),{0,0,0},{ 0, 84,255),{0,0,0},{ 95, 0,255),{0,0,0},{255, 0,221),{0,0,0}
}
int t2[16][3]={
{255,255,255},{0,0,0},{255, 0, 0),{0,0,0},{255,187, 0),{0,0,0},{255,228, 0),{0,0,0},
{ 29,219, 22),{0,0,0},{ 0, 84,255),{0,0,0},{ 95, 0,255),{0,0,0},{255, 0,221),{0,0,0}
}
int index0=0,index2=0;
long t,t0=0,t2=0;
//
void setup(){
strip.begin(); strip.show();
}
//
void led_on_0(){
strip.setPixelColor(0,t0[index0][0],t0[index0][1],t0[index0][2]); strip.show();
if(++index0>=16)index0=0;
}
//
void led_on_2(){
strip.setPixelColor(2,t2[index2][0],t2[index2][1],t2[index2][2]); strip.show();
if(++index2>=16)index2=0;
}
//
void loop(){
t=millis();
if(t>=(t0+ 90)){ t0=t; led_on_0(); }
if(t>=(t2+100)){ t2=t; led_on_2(); }
}
댓글 0
조회수 76등록된 댓글이 없습니다.