Incremental counting problems

Hi there,

We’ve been handed some code to install on an Arduino pro mini to control some DMX 512 addressable theatre lights that have been retro-fitted with all new control gear + Arduino.

In this application there are three push buttons:

  1. Enter
  2. Down
  3. Up

These buttons are used to set the DMX address of the fixture by using the Up/Down push buttons. The Arduino interprets the digital inputs and then outputs to the LCD screen.

We are experiencing issues with the changing of the required values chosen by the Up/Down push buttons. Instead of reliably increasing/decreasing by one increment with each button push, randomly we find the value either returning to the starting value OR the value jumps around randomly (i.e. increments not equal to 1).

What confuses us is that we can use the push buttons to increase or decrease by one step which is correct, however the very next button press may change this value by x.

Once we have a DMX value set, it is correctly displayed and operation of the fixture is perfect. The issue occurs when we change this DMX value.

We’ve attached all the code that is uploaded to the fixture and any advice or directions would be greatly appreciated. Thanks!

OSRAM55100A_LED_Display7.ino (3.55 KB)

characters.ino (1.69 KB)

display.ino (4.76 KB)

dmx.ino (686 Bytes)

eeprom.ino (979 Bytes)

   digitalWrite(dipSwitchPins[i],INPUT_PULLUP);

WTF? You write HIGH or LOW to digital pins OR you look like an idiot.

You are incrementing or decrementing the address when the switch IS pressed, not when it BECOMES pressed. Look at the state change detection example to see how to increment or decrement only when the switch BECOMES pressed.