Portál AbcLinuxu, 10. května 2025 09:47
#!/usr/bin/python import RPi.GPIO as GPIO GPIO.setup(12, GPIO.OUT) GPIO.output(12, True)Dávka nefungovala, resp. asi fungovala, ale po jejím ukončení napětí opět naběhlo. Možná na ledce by bylo vidět zabliknutí. Zkusil jsem tedy jiný návod, instalace proběhla v pohodě, ale pokus o použití příkazu gpio-admin export 22 končí hlášením
gpio-admin: could not flush data to /sys/class/gpio/export: Device or resource busyMěl by někdo nápad či radu? Předem díky. Jirka
Jakou verzi RPi.GPIO používáš? GPIO output being reset on python script ending...
Cleanup
At the end any program, it is good practice to clean up any resources you might have used. This is no different with RPi.GPIO. By returning all channels you have used back to inputs with no pull up/down, you can avoid accidental damage to your RPi by shorting out the pins. Note that this will only clean up GPIO channels that your script has used. Note that GPIO.cleanup() also clears the pin numbering system in use.
A ještě by tě mohlo zajímat: How to use GPIOs on raspberry pi (Simple I/O, PWM and UART)
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.