Clip LED

I’m building a zynthian based sound box, with no display and no encoder. Only one panic/reset button and one operation/clip LED.

I already manage to drive the led manually via “gpio write” commands, but i don’t know how to integrate into the gui scripts.

If I add “import RBi.GPIO” in the zynthian_gui.py it simply hangs up.

Any suggestion?

1 Like

Hi @arizzello!

Nice to meet you! Welcome to the zynthian community!

If no GUI at all, how do you intend to create the layers, load snapshots, etc.?
Do you have a second zynthian for that? :wink:

Regarding your questions, i would need a more detailed explanation of what you are trying to do …
Some code / pseudocode would help …

Kind Regards,

I’m creating the snapshots and zs3 via hdmi and mouse. During the gig, I’m using regular program changes.

I get the led working by adding a function in zyncoder.c and then calling that when necessary in the zynthian_gui.py

void driveOutput(uint8_t pin, uint8_t logic)
{
pinMode(pin, OUTPUT);
digitalWrite(pin, logic) ;
}

Is there a better / more elegant way ?

2 Likes

Normally, all the “hardware” controlling stuff should be in the zyncoder, so i think it’s OK.
Anyway, you should think about how to minimize the effort of maintaining your modified zynthian software up-to-date. Perhaps i could help you with that if you send me your customized zynthian_gui.py…

Kind Regards!

Yes, you are right.
It would be a great idea to include the above few lines in the official zyncoder.

About the zynthian_gui.py i had not enough time to implement the clip red led, i only created the “running” green led:

in def start(self):
lib_zyncoder.driveOutput(GREEN_LED,1)

in def stop(self):
lib_zyncoder.driveOutput(GREEN_LED,0)

(sorry i’m touring right now and i have no access to my source code…)