Jump to content

"smart" button selection with NG


Zam
 Share

Recommended Posts

Hi all

I want to implement a smart select function for my controler.

The goal is simple, let say you have 8 button (and led) in a row,

if you push button 3 and 6, led 3,4,5 and 6 is active

if you push any button again, only this event is active

if you push then button 8 and 4, led 4,5,6,7 and 8 is active

etc...

Any strategy recommanded to achieve this ?

I like to avoid NRG for this function but right now I don't see how to handle this with NGC only.

 

For the moment I have in mid NGR that get first(A) and second(B) value given by button N°

set a value(C) according to how many button are involved between, C=(B-A)+1

set a value(D) that give the button offset, D=A-1

then conditional for each event M,N,O...T like

if D<1 elsif C>8 set M=on

if D<2 elsif C>7 set N=on

if D<3 elsif C>6 set O=on

....

if D<8 elsif C>5 set T=on

 

I think I will also need a flip in case first button is higher count

like If C<0 then C=C-(2C)

As a delay (like 500ms) to let the system don't wait forever if only one button is pressed

 

Input welcome

 

Best

Zam

 

 

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...