Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 1225

Python • Re: Make this LED stay on

$
0
0
I suspect your problem is related to using gpiozero' to drive the LEDs.

From what I remember gpiozero resets all used GPIO to their default state when your program exits.

It could also be the GPIO.cleanup() but I don't see the function it's in ever being called.

Assuming I'm correct your options seem to include:
  • Using something other than gpiozero to drive the LEDs that doesn't do this.
  • Launching your program once (e.g. under a systemd service) with your measure_weight() function wrapped in an infinite loop with a suitable delay (if you want precise timing you'll need to calculate the interval each iteration).
On a related note, you seems to be importing stuff that you don't use and importing sleep twice (once under import time and again under from time import sleep

Statistics: Posted by thagrol — Wed Mar 12, 2025 4:47 pm



Viewing all articles
Browse latest Browse all 1225

Trending Articles