Thanks!!
Timer1 worked great.
here is the finnish code:
#include
#include
int sensorPin = A0; // select the input pin for the potentiometer
int DmxValue = 0; // variable to store the value coming from the sensor
int ChannelValue=0;
int RawValue1=0;
int RawValue2=0;
const int buttonPin = 7;
void setup() {
DmxSimple.usePin(6);// as standard the DmxSimple uses D3 but for this we need D7
DigitShield.begin();
pinMode(buttonPin, INPUT);
digitalWrite(buttonPin, HIGH);
}
void loop() {
int val = digitalRead(buttonPin);
if (val == LOW) {
// set Dmx channel
RawValue1 = analogRead(sensorPin);
ChannelValue = map(RawValue1, 0, 1023, 1, 512);
DigitShield.setValue(ChannelValue);
}
else {
// Set DMX value
RawValue2 = analogRead(sensorPin);
DmxValue = map(RawValue2, 0, 1023, 0, 255);
DigitShield.setValue(DmxValue);
}
DmxSimple.write(ChannelValue, DmxValue);
}