Jump to content

button and LED code help


eptheca
 Share

Recommended Posts

I'm bulding a MB64, and have a problem I need help with

I need the buttons and leds to work so that only the last pressed button's LED light up

I have used the code in this post

this works sort of, but it affects all types of button press, not only "onOnly" like I would like it to

also I would like it to only affect the buttons within the same shift register

I use 2 SR, the first have 8 buttons with it's LEDs, and all 8 have an "onOnly" message

I would like these to only light the last pressed

in the second SR I have 3 buttons with "Toggle" message that I would like to light LED when pressed and turn off LED when pressed again

and I have 4 buttons with "onOnly" message that I would like the LEDs to light up only the last pressed of these 4

Is it possible to have the code from the post I linked to to only work for "onOnly" buttons and only within the same SR

I would really appreciate some help with this, my coding "skills" are limited to editing :(

Link to comment
Share on other sites

here is a short video of how the buttons and LEDs work now

sorry, I can't embed

TK, please can you help me out

I have built the hardware and ordered the frontplate :(

here is the code I have changed

 ;; (button value stored in TMP1)

MB64_BUTTON_OnOnly 

        ;; when on: send button value defined in dump 

        ;; when off: send nothing 

        BRA_IFSET TMP1, 0, ACCESS, MB64_BUTTON_NotifyChangeEnd 

        ;; turn off SR1 8 LEDs 

    SET_BSR MB64_BUTTON_VALUES_SR0+0  

    setf MB64_BUTTON_VALUES_SR0+0

    SET_BSR MB64_BUTTON_VALUES_SR0+1  

    setf MB64_BUTTON_VALUES_SR0+1 

        ;; save status of button 

        rcall   MB64_BUTTON_Hlp_SaveStat 

        rgoto   MB64_BUTTON_Send

thanks in advance

Edited by eptheca
Link to comment
Share on other sites

here is the code I have changed

 ;; (button value stored in TMP1)<BR>MB64_BUTTON_OnOnly <BR>        ;; when on: send button value defined in dump <BR>        ;; when off: send nothing <BR>        BRA_IFSET TMP1, 0, ACCESS, MB64_BUTTON_NotifyChangeEnd <BR>        ;; turn off SR1 8 LEDs <BR>    SET_BSR MB64_BUTTON_VALUES_SR0+0  <BR>    setf MB64_BUTTON_VALUES_SR0+0<BR>    SET_BSR MB64_BUTTON_VALUES_SR0+1  <BR>    setf MB64_BUTTON_VALUES_SR0+1 <BR>        ;; save status of button <BR>        rcall   MB64_BUTTON_Hlp_SaveStat <BR>        rgoto   MB64_BUTTON_Send

That's slightly unreadable... could you reformat?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...