Last active
August 29, 2015 14:03
-
-
Save kamiyaowl/61f11f3238e1e507c2bb to your computer and use it in GitHub Desktop.
Arduino DMX Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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