Skip to content

Instantly share code, notes, and snippets.

@magcho
Last active January 4, 2018 09:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save magcho/257ba101ae0ba998f83275564c8c5f6a to your computer and use it in GitHub Desktop.
Save magcho/257ba101ae0ba998f83275564c8c5f6a to your computer and use it in GitHub Desktop.
#include "DMXSerial.h"
int startCh = 0;//DMXのスタートアドレス
void setup()
{
DMXSerial.init(DMXReceiver);
pinMode(13, OUTPUT);
}
void loop()
{
unsigned long lastPacket = DMXSerial.noDataSince();
if (lastPacket < 5000) {
byte dmx[4];
for (int i = 0;i < 4;i++)
dmx[i] = DMXSerial.read(startCh + i);
if(dmx[1] >= 127){
digitalWrite(13, HIGH);
}else{
digitalWrite(13, LOW);
}
}
}
@magcho
Copy link
Author

magcho commented Jan 4, 2018

dmx recever_

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment