【Arduino】Unity3d交互灯带的控制

Arudino代码:

//灯带变量
#include 
#define PIN 8 //输出引脚
#define PIN1 9 //输出引脚
#define PIN2 10 //输出引脚
#define PIN3 11 //输出引脚

#define MAX_LED 100  //最大灯珠
#define ADD true
#define SUB false
int val = 0;
boolean stat = ADD;
boolean ifdown = SUB;
uint32_t white,red,black;
Adafruit_NeoPixel strip = Adafruit_NeoPixel( MAX_LED, PIN, NEO_RGB + NEO_KHZ800 );
Adafruit_NeoPixel strip1 = Adafruit_NeoPixel( MAX_LED, PIN1, NEO_RGB + NEO_KHZ800 );
Adafruit_NeoPixel strip2 = Adafruit_NeoPixel( MAX_LED, PIN2, NEO_RGB + NEO_KHZ800 );
Adafruit_NeoPixel strip3 = Adafruit_NeoPixel( MAX_LED, PIN3, NEO_RGB + NEO_KHZ800 );

//状态变量
int buttonState1 = 0;

//计时变量
unsigned long t1 = 0;
unsigned long t2 = 5;
unsigned long times = 0;

void setup() {

Serial.begin(9600);

white = strip.Color(255, 255, 255);         //选择所显示的颜色
red = strip.Color(0, 255, 0);  
black=strip.Color(0, 0, 0); 
strip.begin();           //初始化Adafruit_NeoPixel;
//for(int i =0;i

 

你可能感兴趣的:(Arduino)