From gpiozero import LED From time import sleep Led=LED(17) While True: Led.on() Sleep(1) Led.off Sleep(1) Standard program: import RPi.GPIO as GPIO from time import sleep GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) led_pin = 17 Blink_count=3 Count=0 While(Count<Blink_count): GPIO.output(led_pin,true) Print(“led on!!”) Sleep(3) Count+=1 GPIO.output(led_pin,false) Print(“led off!!”) Sleep(1) Count+=1 Finally: GPIO.cleanup()
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter