Page 1 of 2
Switching on/off a single LED in an array of 64 Leds
Posted: 22 Dec 2011 00:24
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
Re: Switching on/off a single LED in an array of 64 Leds
Posted: 22 Dec 2011 02:10
by lABl
Hi dbk,
I have attached an example, hope that helps.
Cheers,
Re: Switching on/off a single LED in an array of 64 Leds
Posted: 22 Dec 2011 08:35
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
Re: Switching on/off a single LED in an array of 64 Leds
Posted: 28 Dec 2011 18:37
by lABl
You're welcome dbk,
Great to know it works
Cheers and happy holidays,
Re: Switching on/off a single LED in an array of 64 Leds
Posted: 01 Jan 2012 00:52
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.
Re: Switching on/off a single LED in an array of 64 Leds
Posted: 01 Jan 2012 13:43
by lABl
Hi MBM,
Don't know if I understand well the question (limited english skills here
)
In any case, I've attached an example using a normal fader (range is between 0...1)
- Imagen 26.png (12.15 KiB) Viewed 8769 times
Hope that helps in someway,
Cheers and happy new year to everyone!
Antonio,
Re: Switching on/off a single LED in an array of 64 Leds
Posted: 01 Jan 2012 22:59
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!
Re: Switching on/off a single LED in an array of 64 Leds
Posted: 02 Jan 2012 11:18
by lABl
Hey MBM
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 (15.39 KiB) Viewed 8727 times
Saludos compañero!
Re: Switching on/off a single LED in an array of 64 Leds
Posted: 03 Jan 2012 00:16
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!
Re: Switching on/off a single LED in an array of 64 Leds
Posted: 03 Jan 2012 11:01
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!