Finally the moving head detected the signal but it's still doing weird
stuff.
I started with a demo for the DMX-shield i bought, the code looks like
this:
/* Welcome to DmxSimple. This library allows you to control DMX stage
and
** architectural lighting and visual effects easily from Arduino.
DmxSimple
** is compatible with the Tinker.it! DMX shield and all known DIY
Arduino
** DMX control circuits.
**
** DmxSimple is available from:
http://code.google.com/p/tinkerit/
** Help and support:
http://groups.google.com/group/dmxsimple */
/* To use DmxSimple, you will need the following line. Arduino will
** auto-insert it if you select Sketch > Import Library > DmxSimple.
*/
/* Modified for use with DMX shield from
www.skpang.co.uk Feb 2010 */
/* Tested with ECO LED PAR56 from Pulse. */
#include <DmxSimple.h>
#define RED_CHANNEL 2
#define GRN_CHANNEL 3
#define BLU_CHANNEL 4
int DMX_dir = 2;
int LED2 = 8;
int LED3 = 7;
void setup() {
pinMode(DMX_dir, OUTPUT);
pinMode(LED2, OUTPUT);
// pinMode(LED3, OUTPUT);
digitalWrite(DMX_dir, HIGH); // Set direction pin of trasnsceiver
to Tx.
/* The most common pin for DMX output is pin 3, which DmxSimple
** uses by default. If you need to change that, do it here. */
DmxSimple.usePin(3);
/* DMX devices typically need to receive a complete set of channels
** even if you only need to adjust the first channel. You can
** easily change the number of channels sent here. If you don't
** do this, DmxSimple will set the maximum channel number to the
** highest channel you DmxSimple.write() to. */
// DmxSimple.maxChannel(4);
}
void loop() {
int brightness;
digitalWrite(LED2, HIGH);
/* Simple loop to ramp up brightness RED */
for (brightness = 0; brightness <= 255; brightness++) {
/* Update DMX channel to new brightness */
DmxSimple.write(RED_CHANNEL, brightness);
/* Small delay to slow down the ramping */
delay(5);
}
digitalWrite(LED2, LOW);
for (brightness = 255; brightness >= 0; brightness--) {
/* Update DMX channel to new brightness */
DmxSimple.write(RED_CHANNEL, brightness);
/* Small delay to slow down the ramping */
delay(5);
}
digitalWrite(LED2, HIGH);
/* Simple loop to ramp up brightness BLUE */
for (brightness = 0; brightness <= 255; brightness++) {
/* Update DMX channel to new brightness */
DmxSimple.write(BLU_CHANNEL, brightness);
/* Small delay to slow down the ramping */
delay(5);
}
digitalWrite(LED2, LOW);
for (brightness = 255; brightness >= 0; brightness--) {
/* Update DMX channel to new brightness */
DmxSimple.write(BLU_CHANNEL, brightness);
/* Small delay to slow down the ramping */
delay(5);
}
digitalWrite(LED2, HIGH);
/* Simple loop to ramp up brightness GREEN */
for (brightness = 0; brightness <= 255; brightness++) {
/* Update DMX channel to new brightness */
DmxSimple.write(GRN_CHANNEL, brightness);
/* Small delay to slow down the ramping */
delay(5);
}
digitalWrite(LED2, LOW);
for (brightness = 255; brightness >= 0; brightness--) {
/* Update DMX channel to new brightness */
DmxSimple.write(GRN_CHANNEL, brightness);
/* Small delay to slow down the ramping */
delay(5);
}
}
I modified it first in this way:
/* Welcome to DmxSimple. This library allows you to control DMX stage
and
** architectural lighting and visual effects easily from Arduino.
DmxSimple
** is compatible with the Tinker.it! DMX shield and all known DIY
Arduino
** DMX control circuits.
**
** DmxSimple is available from:
http://code.google.com/p/tinkerit/
** Help and support:
http://groups.google.com/group/dmxsimple */
/* To use DmxSimple, you will need the following line. Arduino will
** auto-insert it if you select Sketch > Import Library > DmxSimple.
*/
/* Modified for use with DMX shield from
www.skpang.co.uk Feb 2010 */
/* Tested with ECO LED PAR56 from Pulse. */
#include <DmxSimple.h>
#define PAN_CHANNEL 1
#define TILT_CHANNEL 2
#define SHUTTER_CHANNEL 3
#define COLOUR_CHANNEL 4
#define GOBO_CHANNEL 5
int DMX_dir = 2;
int LED2 = 8;
int LED3 = 7;
void setup() {
pinMode(DMX_dir, OUTPUT);
pinMode(LED2, OUTPUT);
// pinMode(LED3, OUTPUT);
digitalWrite(DMX_dir, HIGH); // Set direction pin of trasnsceiver
to Tx.
/* The most common pin for DMX output is pin 3, which DmxSimple
** uses by default. If you need to change that, do it here. */
DmxSimple.usePin(3);
/* DMX devices typically need to receive a complete set of channels
** even if you only need to adjust the first channel. You can
** easily change the number of channels sent here. If you don't
** do this, DmxSimple will set the maximum channel number to the
** highest channel you DmxSimple.write() to. */
// DmxSimple.maxChannel(4);
}
void loop() {
int pan;
int tilt;
int shutter;
int colour;
int gobo;
digitalWrite(LED2, HIGH);
/* Simple loop to ramp up brightness RED */
for (pan = 0; pan <= 255; pan++) {
/* Update DMX channel to new brightness */
DmxSimple.write(PAN_CHANNEL, pan);
/* Small delay to slow down the ramping */
delay(5);
}
digitalWrite(LED2, LOW);
for (pan = 255; pan >= 0; pan--) {
/* Update DMX channel to new brightness */
DmxSimple.write(PAN_CHANNEL, pan);
/* Small delay to slow down the ramping */
delay(2);
}
digitalWrite(LED2, HIGH);
/* Simple loop to ramp up brightness BLUE */
for (tilt = 0; tilt <= 255; tilt++) {
/* Update DMX channel to new brightness */
DmxSimple.write(TILT_CHANNEL, tilt);
/* Small delay to slow down the ramping */
delay(2);
}
digitalWrite(LED2, LOW);
for (tilt = 255; tilt >= 0; tilt--) {
/* Update DMX channel to new brightness */
DmxSimple.write(TILT_CHANNEL, tilt);
/* Small delay to slow down the ramping */
delay(2);
}
digitalWrite(LED2, HIGH);
/* Simple loop to ramp up brightness GREEN */
for (shutter = 8; shutter <= 134; shutter++) {
/* Update DMX channel to new brightness */
DmxSimple.write(SHUTTER_CHANNEL, shutter);
/* Small delay to slow down the ramping */
delay(2);
}
digitalWrite(LED2, LOW);
for (shutter = 134; shutter >= 8; shutter--) {
/* Update DMX channel to new brightness */
DmxSimple.write(SHUTTER_CHANNEL, shutter);
/* Small delay to slow down the ramping */
delay(2);
}
digitalWrite(LED2, HIGH);
/* Simple loop to ramp up brightness GREEN */
for (colour = 8; colour <= 21; colour++) {
/* Update DMX channel to new brightness */
DmxSimple.write(COLOUR_CHANNEL, shutter);
/* Small delay to slow down the ramping */
delay(2);
}
digitalWrite(LED2, LOW);
for (colour = 21; colour >= 8; colour--) {
/* Update DMX channel to new brightness */
DmxSimple.write(COLOUR_CHANNEL, colour);
/* Small delay to slow down the ramping */
delay(2);
}
digitalWrite(LED2, HIGH);
/* Simple loop to ramp up brightness GREEN */
for (gobo = 8; gobo <= 21; gobo++) {
/* Update DMX channel to new brightness */
DmxSimple.write(GOBO_CHANNEL, gobo);
/* Small delay to slow down the ramping */
delay(2);
}
digitalWrite(LED2, LOW);
for (gobo = 21; gobo >= 8; gobo--) {
/* Update DMX channel to new brightness */
DmxSimple.write(GOBO_CHANNEL, gobo);
/* Small delay to slow down the ramping */
delay(2);
}
}
And then i tried to reduce it:
#include <DmxSimple.h>
#define PAN_CHANNEL 1
#define TILT_CHANNEL 2
#define SHUTTER_CHANNEL 3
#define COLOUR_CHANNEL 4
#define GOBO_CHANNEL 5
int DMX_dir = 2;
int LED2 = 8;
int LED3 = 7;
//int LED4 = 6;
void setup() {
pinMode(DMX_dir, OUTPUT);
pinMode(LED2, OUTPUT);
//pinMode(LED3, OUTPUT);
//pinMode(LED4, OUTPUT);
digitalWrite(DMX_dir, HIGH); // Set direction pin of trasnsceiver
to Tx.
/* The most common pin for DMX output is pin 3, which DmxSimple
** uses by default. If you need to change that, do it here. */
DmxSimple.usePin(3);
/* DMX devices typically need to receive a complete set of channels
** even if you only need to adjust the first channel. You can
** easily change the number of channels sent here. If you don't
** do this, DmxSimple will set the maximum channel number to the
** highest channel you DmxSimple.write() to. */
// DmxSimple.maxChannel(4);
}
void loop() {
int pan;
int tilt;
int shutter = 255;
int colour = 21;
int gobo = 12;
digitalWrite(DMX_dir, HIGH);
DmxSimple.write(PAN_CHANNEL, 128);
digitalWrite(DMX_dir, HIGH);
DmxSimple.write(TILT_CHANNEL, 128);
DmxSimple.write(SHUTTER_CHANNEL, 255);
DmxSimple.write(COLOUR_CHANNEL, 21);
DmxSimple.write(GOBO_CHANNEL, 12);
}
It reacts somehow to the movement values (in fact not in the correct
way), but there is no reaction to shutter, colour and gobo values.