Skip to content

Zainamusleh/button_task

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

button_task

A task to turn on and off the LED using raspberry pi ,GPIOZERO

Employee data

libaries used in the code from gpiozero import Button from gpiozero import LED from time import sleep

Code explaining : ` from gpiozero import LED, Button

button = Button(3) led = LED(2)

clicks = 0

while True: # Check if button is pressed if button.is_pressed: clicks += 1 sleep(0.5)

# Check if number of clicks is even or odd
if clicks % 2 != 0:
    led.on()
    sleep(0.5)

elif clicks % 2 == 0:
    led.off()
    sleep(0.5)

`

Team:

`

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages