来源:http://www.seeedstudio.com/wiki/Grove_-_DMX512
#include <DmxSimple.h>
void setup() {
DmxSimple.usePin(3); //3 是端口号 可选择 0-13中的一个
//DmxSimple.maxChannel(6);
DmxSimple.write(1, 255); //参数一:1代表调节水平摆动
}
void loop() {
int brightness;
for (brightness = 0; brightness <= 255; brightness--) {
DmxSimple.write(2,100); //参数一:2代表垂直摆动 参数二:100代表转动的多少 值范围0-255
DmxSimple.write(3,brightness); // 参数一:3代表白光 参数二:brightness代表白光强弱 0表示没有 255最亮
DmxSimple.write(4,255); //参数一: 4代表闪动情况 参数二 0-255
DmxSimple.write(5,255); //参数一: 5代表颜色选择 参数二 0-255
DmxSimple.write(6,brightness); //参数一:6 代表可选图案 参数二 0-255
/* Small delay to slow down the ramping */
delay(5);
}
}