Jump to content

Recommended Posts

Hello,

How I can use a 3x programmable led's onboard? I don't find info about this. Can you show me an example code in Python? Alternative, which number of GPIO they have?

Thank you
LL

Share this post


Link to post
Share on other sites
I do not understand what you mean. I am posting the original schematic with 3x programmable LEDs on the left, next to the cooler. I would like to use them in a project, but I don't know how to control them. I am interested in using them in the Python environment.

Share this post


Link to post
Share on other sites

hello @Lionel Leyko, gotcha. the 3 LEDs have been registered with LED GPIO subsystem.

here are the commands to control the LEDs: 

sudo su

echo 1 > /sys/class/leds/led1/brightness

echo 0 > /sys/class/leds/led1/brightness

echo 1 > /sys/class/leds/led2/brightness

echo 0 > /sys/class/leds/led2/brightness

echo 1 > /sys/class/leds/led3/brightness

echo 0 > /sys/class/leds/led3/brightness

Share this post


Link to post
Share on other sites

We use the gpio-leds module to control the led and keep them not light as default.

In fsl-imx8mq-phanbell.dts:

        gpio-leds {
                compatible = "gpio-leds";

                led1 {
                        gpios = <&gpio3 21 GPIO_ACTIVE_HIGH>;
                        linux,default-trigger="none";
                };

                led2 {
                        gpios = <&gpio4 29 GPIO_ACTIVE_HIGH>;
                        linux,default-trigger="none";
                };

                led3 {
                        gpios = <&gpio4 28 GPIO_ACTIVE_HIGH>;
                        linux,default-trigger="none";
                };
        };

(led gpio is low active)

Because the gpios have been registered by gpio leds module, you cannot use gpio library to register them again.
Please control them by the nodes in /sys/class/leds/.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...