Programing for DIP-Switch

It's connected to pin 0.

As I suspected. Pin 0 on an Uno is the hardware serial RX pin. You cannot use pin 0 for both, that is why Serial.begin breaks your program. DMX must have the hardware serial because only hardware serial can handle DMX’s required baud rate (250000). So you can’t use Serial to print to serial monitor. If you want debug messages you will need to use a different serial port. You could connect a TTL to USB converter to 2 other pins and use a software serial port for debug.

Thank you for clearing that out! :slight_smile:

I feel like thats way to advanced for me, what would be the second best option? Write the code separatly and test it before merging it with my original and remove the serial?

Well, you can’t use Serial so… The alternative, if software serial is out, is to install an LCD or other display. Or use some LEDs to show what is happening. So instead of serial prints you light or extinguish LEDs to track what is going on.

Thanks, the LEDs im pretty sure i can do.

Tried out the PULLUP-sketch from library. Im sure its wired correctly but its just printing "1" in the monitor, no matter what state the dip is in. Tried changing dip (in case the first one was bad) but no luck.

digin.jpgIs it wired like this?

Yes, must be the dip switches?

Try this code to test individual switches. Change switchPin to suit your wiring. Serial monitor should show 1 for not pressed and 0 for pressed. I know that you tried it, but I can't see the code that you used and I know that the supplied code will work.

const byte switchPin = 2;

void setup()
{
  Serial.begin(9600);
  pinMode(switchPin, INPUT_PULLUP);
}

void loop()
{
  Serial.println(digitalRead(switchPin));
  delay(500);
}