Jump to content

Can anyone help me with Led group on ain64_din128_dout128_v1_3 or 2.0


ultrasound
 Share

Recommended Posts

Hello

I have an idea but i dont know how to do this:

When i will press button #1 - the led under the button will turn on

when i will press button #6 - the led under the button #1 will turn off and the led under button #6 will turn on

...

and so on...

... and, how can i make some groups ?

By groups i mean something like this:

I have one group of 10 buttons with leds and another group of 10 buttons with leds, and i want that leds in only one group will switch betwen them.

Greets

Link to comment
Share on other sites

There are a few ways that you could do something like this, and the best will depend on lots of factors... I would probably store the button/LED on/off states in an int (or 2 chars) and update the CS accordingly. You could use arrays to 'group' these ints.

Hope that helps!

Link to comment
Share on other sites

You could use arrays to 'group' these ints.

yes.

or you could set up one or more bitfields (8 bits max) instead of an array.

this involves strucs (and unions), so I hope I don't confuse you ;)

example:

typedef union {
	struct {
		unsigned ALL:8;
	};
	struct {
		unsigned led1:1;
		unsigned led2:1;
		unsigned led3:1;	
		unsigned led4:1;
		unsigned free:4;
	};
} something_t;

// declare var
something_t something;

// set bits
something.led1 = 1;
something.led3 = 0;

// get number
mynum = something.ALL;

regards,

Michael

Link to comment
Share on other sites

  • 7 months later...
  • 4 weeks later...

Hi David,

generally spoken, this is a nice, clean (clearly named) and effective method to set some values; very small in size - and by making a union out of the structure, these states can easily be accessed as an unsigned int, which makes conversions unnecessary (eg when reading or writing a patch - or setting all bits at once!).

The disadvantage is, that SDCC currently only allowes bitfields of 8 bits maximum, which might make things complicated (at least it has been for SDCC 2.4.x, dunno about 2.7.x).

Another disadvantage can be the way to access the bits. For example, you need to loop through all values in the struct, one by one. This way you either have to work on the bits with bitmasks or you need to address all struct names seperately which is not possible with a counter.

I guess, a (boolean) array should be nearly as effective as a bitfield. Its maximum is 255 bytes (? can't remember exactly, nevertheless this is big). Access is easy, but not that straightforward if you want to load/save the whole array.

So, it clearly depends  ;D

Best,

Michael

ps: thanks, julien  :D

Link to comment
Share on other sites

  • 4 weeks later...
  • 3 weeks later...

Hi

I'm looking for somebody who can help me with led groups for buttons [notes]

example:

While pressing button #1 - the led under the button will turn on

While pressing button #6 - the led under the button #1 will turn off and the led under button #6 will turn on

I have one group of 10 buttons with leds and another group of 10 buttons with leds, and i want that groups of leds work independently. So that, when I push the button from 1st group and the button from 2nd group, they both led will be turn on. But when I turn on, for example, the other button from 2nd group, the led from the 2nd group will switch(the new one will be now shinning) but in the 1st group nothing will change.

My controller (check the enclosure):

group 1:

90x00

90x01

90x02

90x03

90x04

90x05

90x06

90x07

90x08

90x09

90x0A

90x0B

Group 2:

90x1C

90x2C

90x3C

90x4C

90x5C

90x6C

90x7C

Group3:

90x1D

90x2D

90x3D

90x4D

90x5D

90x6D

90x7D

Group4:

90x10

90x11

90x12

90x13

90x14

90x15

90x16

90x17

90x18

90x19

90x1A

90x1B

90x20

90x21

90x22

90x23

90x24

90x25

90x26

90x27

90x28

90x29

90x2A

90x2B

90x30

90x31

90x32

90x33

90x34

90x35

90x36

90x37

90x38

90x39

90x3A

90x3B

90x40

90x41

90x42

90x43

90x44

90x45

90x46

90x47

90x48

90x49

90x4A

90x4B

90x50

90x51

90x52

90x53

90x54

90x55

90x56

90x57

90x58

90x59

90x5A

90x5B

90x60

90x61

90x62

90x63

90x64

90x65

90x66

90x67

90x68

90x69

90x6A

90x6B

90x70

90x71

90x72

90x73

90x74

90x75

90x76

90x77

90x78

90x79

90x7A

90x7B

NEXT  NOTES Of WHAT I NEED:

90x0C

90x0D

90x0F

90x1F

90x2F

90x3F

90x4F

90x5F

90x6F

But leds for that and rest notes must be like that, I push the button>led turn on, I push the button again (turn off the effect)>led turn off

Can anyone help me to change ain64_din128_dout128_v1_3 code?

I hope, that all i wrote, it's not too knotty..

Best Regards

Waiting for proposition

lastudio groups_thumb.jpg

2183_lastudio_groups_jpg7e88048e3adfb233

Link to comment
Share on other sites

Hi

I'm looking for somebody who can help me with led groups for buttons [notes]

example:

While pressing button #1 - the led under the button will turn on

While pressing button #6 - the led under the button #1 will turn off and the led under button #6 will turn on

I have one group of 10 buttons with leds and another group of 10 buttons with leds, and i want that groups of leds work independently. So that, when I push the button from 1st group and the button from 2nd group, they both led will be turn on. But when I turn on, for example, the other button from 2nd group, the led from the 2nd group will switch(the new one will be now shinning) but in the 1st group nothing will change.

My controller (check the enclosure):

group 1:

90x00

90x01

90x02

90x03

90x04

90x05

90x06

90x07

90x08

90x09

90x0A

90x0B

Group 2:

90x1C

90x2C

90x3C

90x4C

90x5C

90x6C

90x7C

Group3:

90x1D

90x2D

90x3D

90x4D

90x5D

90x6D

90x7D

Group4:

90x10

90x11

90x12

90x13

90x14

90x15

90x16

90x17

90x18

90x19

90x1A

90x1B

90x20

90x21

90x22

90x23

90x24

90x25

90x26

90x27

90x28

90x29

90x2A

90x2B

90x30

90x31

90x32

90x33

90x34

90x35

90x36

90x37

90x38

90x39

90x3A

90x3B

90x40

90x41

90x42

90x43

90x44

90x45

90x46

90x47

90x48

90x49

90x4A

90x4B

90x50

90x51

90x52

90x53

90x54

90x55

90x56

90x57

90x58

90x59

90x5A

90x5B

90x60

90x61

90x62

90x63

90x64

90x65

90x66

90x67

90x68

90x69

90x6A

90x6B

90x70

90x71

90x72

90x73

90x74

90x75

90x76

90x77

90x78

90x79

90x7A

90x7B

NEXT  NOTES Of WHAT I NEED:

90x0C

90x0D

90x0F

90x1F

90x2F

90x3F

90x4F

90x5F

90x6F

But leds for that and rest notes must be like that, I push the button>led turn on, I push the button again (turn off the effect)>led turn off

Can anyone help me to change ain64_din128_dout128_v1_3 code?

I hope, that all i wrote, it's not too knotty..

Best Regards

Waiting for proposition

lastudio groups_thumb.jpg

2236_lastudio_groups_jpg7e88048e3adfb233

Link to comment
Share on other sites

what you are asking for (I think, I'm a bit confused from the explaination) is very easy to do in C.

Find the function that is triggered when a midi note is received.

Build a switch or series of If statements that catch the note value.

Turn LED on or off according to a flag (variable) for each LED

Then reset the flag.

easy!

Link to comment
Share on other sites

  • 1 month later...

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