New answers tagged

0

import time import rgpio L1=16 L2=26 sbc = rgpio.sbc() h = sbc.gpiochip_open(0) sbc.gpio_claim_output(h, L1) sbc.gpio_claim_output(h, L2) sbc.tx_pwm(h, L1, 10, 50) sbc.tx_pwm(h, L2, 10, 50, pulse_offset=50000) time.sleep(20) sbc.gpiochip_close(h) sbc.stop()


0

Your LED might be turning off when the end of the script is reached, for example the following script will turn the LED on for 5 seconds, then end, and restore the pin back to its original state (LED off): from gpiozero import LED from time import sleep led = LED(5) led.on() sleep(5) In order to keep the LED on indefinitely, the script must be kept alive. ...


1

Using the lgpio Python module. #!/usr/bin/env python """ http://abyz.me.uk/lg/py_lgpio.html """ import time import lgpio as sbc L1=16 L2=26 h = sbc.gpiochip_open(0) sbc.gpio_claim_output(h, L1) sbc.gpio_claim_output(h, L2) sbc.tx_pwm(h, L1, 10, 50) sbc.tx_pwm(h, L2, 10, 50, pulse_offset=50000) time.sleep(20) sbc....


0

Since I don't have enough reputation to comment... In the PI4J library, you use constants like "GPIO_16"... However, these are not the GPIO pins that you find in the RPI documentation. They are the WiringPI pins. A mapping is here: https://pinout.xyz/pinout/wiringpi


Top 50 recent answers are included