Incremental counting problems


hi there,

we've been handed code install on arduino pro mini control dmx 512 addressable theatre lights have been retro-fitted new control gear + arduino.

in application there 3 push buttons:
1. enter
2. down
3. up

these buttons used set dmx address of fixture using up/down push buttons.  the arduino interprets digital inputs , outputs lcd screen.

we experiencing issues changing of required values chosen up/down push buttons. instead of reliably increasing/decreasing 1 increment each button push, randomly find value either returning starting value or value jumps around randomly (i.e. increments not equal 1).  

what confuses can use push buttons increase or decrease 1 step correct, next button press may change value x.

once have dmx value set, correctly displayed , operation of fixture perfect.  the issue occurs when change dmx value.

we've attached code uploaded fixture , advice or directions appreciated.  thanks!

code: [select]
   digitalwrite(dipswitchpins[i],input_pullup);
wtf? write high or low digital pins or idiot.

you incrementing or decrementing address when switch pressed, not when becomes pressed. @ state change detection example see how increment or decrement when switch becomes pressed.


Arduino Forum > Using Arduino > Programming Questions > Incremental counting problems


arduino

Comments