Skip to content

Instantly share code, notes, and snippets.

@kamiyaowl
Last active August 29, 2015 14:03
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 kamiyaowl/61f11f3238e1e507c2bb to your computer and use it in GitHub Desktop.
Save kamiyaowl/61f11f3238e1e507c2bb to your computer and use it in GitHub Desktop.
Arduino DMX Test
#define DMXCHANNELS 8
void setup()
{
}
uint8_t data[DMXCHANNELS] = {0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,};
uint8_t tx = 1;
void loop()
{
pinMode(tx,OUTPUT);
digitalWrite(tx,0);//Break
delayMicroseconds(88);
digitalWrite(tx,1);//MAB
delayMicroseconds(8);
Serial.begin(250000,SERIAL_8N2);
Serial.write(0x0);//Start Code
for(uint16_t i = 0 ; i < DMXCHANNELS ; ++i){
Serial.write(data[i]);//Ch Data
}
Serial.end();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment