Switching on/off a single LED in an array of 64 Leds

Discuss Lemur and share techniques.
dbk
Regular
Posts: 98
Joined: 14 Dec 2011 11:35

Switching on/off a single LED in an array of 64 Leds

Post by dbk »

Hello,

i´m creating a pattern changer for a Machinedrum, i have 64 Leds in front of 64 switches, so far everything works fine.

the plan is, that the switch (not visible) turns on the Led above it. like you´ve seen it in teh fantastic Scapes Template for the lemur. I tried to find out how he did it, but i didn´t get through his code, way above my head :/

i imagine the code could be something like this:

Code: Select all

setattribute(Leds.x[firstof(Switch.x)], 'Value', 1);
however, i have a hard time finding a way to switch on a given Led of the 64.

A little hint in the right direction would be very much apprechiated.

thanks in advance,
Martin
lABl
Lemur Guru
Posts: 269
Joined: 09 Dec 2011 15:56
Contact:

Re: Switching on/off a single LED in an array of 64 Leds

Post by lABl »

Hi dbk,

I have attached an example, hope that helps.
abRadioLeds.jzlib.zip
(914 Bytes) Downloaded 320 times
Cheers,
dbk
Regular
Posts: 98
Joined: 14 Dec 2011 11:35

Re: Switching on/off a single LED in an array of 64 Leds

Post by dbk »

Hello Antonio,


thanks a lot for providing an example. This helped a lot and i learned the usage of stretch.

i really like your scapes template, the gui is fantastic too.

thanks again and cheers,
Martin
lABl
Lemur Guru
Posts: 269
Joined: 09 Dec 2011 15:56
Contact:

Re: Switching on/off a single LED in an array of 64 Leds

Post by lABl »

You're welcome dbk,

Great to know it works ;)

Cheers and happy holidays,
MBM
Regular
Posts: 55
Joined: 10 Dec 2011 22:42

Re: Switching on/off a single LED in an array of 64 Leds

Post by MBM »

And what if I would like using LEDs like level meters? So, a row of 16 LEDs, for example, all of them green all the time (on and off) except last three, that turns red when they turn ON. Is it possible?

Thanks and best regards.
lABl
Lemur Guru
Posts: 269
Joined: 09 Dec 2011 15:56
Contact:

Re: Switching on/off a single LED in an array of 64 Leds

Post by lABl »

Hi MBM,

Don't know if I understand well the question (limited english skills here :D )

In any case, I've attached an example using a normal fader (range is between 0...1)
Imagen 26.png
Imagen 26.png (12.15 KiB) Viewed 8778 times
Hope that helps in someway,
Cheers and happy new year to everyone!
Antonio,
Attachments
LedsMeter.jzlib.zip
(1005 Bytes) Downloaded 220 times
MBM
Regular
Posts: 55
Joined: 10 Dec 2011 22:42

Re: Switching on/off a single LED in an array of 64 Leds

Post by MBM »

Hey, Antonio, thank you very much :-)

Your english hasn´t any problem, it´s mine wich has it ;)

I´m trying to adapt your example to "value" from "ledMain" (to get externals values from OSC), but I can´t... How could I do it?

(In spanish):

Hola Antonio, muchas gracias! :-)

Mi intención es que funcione como tu ejemplo, pero en vez de hacerlo con el fader, lo haga con valores provenientes via OSC. Lo he intentado con tu ejemplo, pero no lo consigo. Abusando de tu amabilidad, ¿cómo podría hacerlo?

Ah, y perdona mi inglés, lo tengo muy oxidado :-)

Gracias y un saludo!
lABl
Lemur Guru
Posts: 269
Joined: 09 Dec 2011 15:56
Contact:

Re: Switching on/off a single LED in an array of 64 Leds

Post by lABl »

Hey MBM :D

Te respondo en español que se me da mejor, he hecho un script para ejecutar sobre un mensaje OSC con dirección /LedsMeterL , no lo he probado porque no tengo el iPad aquí, espero que funcione, solo recuerda que el valor que envíes debe estar entre 0..1
LedsOSC.png
LedsOSC.png (15.39 KiB) Viewed 8736 times
Saludos compañero!
Attachments
LedsOSC1.jzlib.zip
(791 Bytes) Downloaded 158 times
MBM
Regular
Posts: 55
Joined: 10 Dec 2011 22:42

Re: Switching on/off a single LED in an array of 64 Leds

Post by MBM »

Mil gracias, Antonio, va de miedo y es lo único que me faltaba para terminar una plantilla que tengo sobre mi patch Max/MSP para mis conciertos, así que me viene de miedo. He comprobado que puedo poner el script del container en cualquiera de los LEDs y sigue funcionando (me interesa sin container), así que me has hecho un favor inmenso, muchísimas gracias. Y además he aprendido sobre Lemur mirando tu código, porque dedicándome a Max tengo muy abandonada la programación de Lemur hace tiempo, que uno no tiene tiempo para todo ya...

Un abrazo!
lABl
Lemur Guru
Posts: 269
Joined: 09 Dec 2011 15:56
Contact:

Re: Switching on/off a single LED in an array of 64 Leds

Post by lABl »

Hey,

Denada compañero, me alegra saber que te funciona, lo del contenedor simplemente puedes hacerlo transparente como ya sabrás, lo hice más que nada por mantener todo el código dentro y fuera más simple, también es un poco mi forma de programar la de dejar los scripts importantes más visibles. Pero ya has visto que puedes moverlo como quieras.

Un saludo!
Post Reply