Hi!
I have prepared a sketch to send a single dmx signal, but I dont know how to write the sketch in order to send the signal for 30 seconds and make a pause for another 30 seconds.
help appreciated!
#include <Conceptinetics.h>
#define DMX_MASTER_CHANNELS 1
#define RXEN_PIN 2
DMX_Master dmx_master (DMX_MASTER_CHANNELS, RXEN_PIN);
void setup() {
dmx_master.enable ();
dmx_master.setChannelRange (1,25,127);
}
void loop() {
dmx_master.setChannelValue (1, 254);
}
blh64
May 4, 2019, 6:36pm
2
Look at the BlinkWithoutDelay example to see a good method for tracking elapsed time
Thanks. there it goes:
#include <Conceptinetics.h>
#define DMX_MASTER_CHANNELS 1
#define RXEN_PIN 2
DMX_Master dmx_master (DMX_MASTER_CHANNELS, RXEN_PIN);
int fogState = 0;
unsigned long previousMillis = 0;
const long interval = 30000;
void setup() {
dmx_master.enable ();
dmx_master.setChannelRange (1, 25, 127);
}
void loop() {
unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= interval) {
previousMillis = currentMillis;
if (fogState == 0) {
fogState = 254;
} else {
fogState = 0;
}
dmx_master.setChannelValue (1, fogState);
}
}
blh64
May 8, 2019, 1:34am
4
Bingo! It looks like you got it working!