Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Update to gpiozero #17

Merged
merged 3 commits into from
Jun 6, 2017
Merged

Update to gpiozero #17

merged 3 commits into from
Jun 6, 2017

Conversation

WillDereham
Copy link
Contributor

Changes final_code.py to use the gpiozero library instead of the
RPi.GPIO module. In response to issue #16 from @bennuttall . I still have to update the worksheet before it is ready to be merged.

Changes final_code.py to use the gpiozero library instead of the
RPi.GPIO module.
@@ -1,7 +1,7 @@
#!/usr/bin/python3
import pygame
import time
from RPi import GPIO
import gpiozero as gpio
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I leave it as gpiozero, shorten it to gpio or just import the Button class? What would work for clarity?

reading = GPIO.input(pin)
print("HIGH" if reading else "LOW")
reading = key.is_pressed
print("ON" if reading else "OFF")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are ON and OFF appropriate names for the values? They aren't accurately represented by HIGH and LOW anymore, as that is handled internally by gpiozero, so should they be anything different, i.e UP and DOWN?

Missed this reference to `HIGH` and `LOW`
@WillDereham WillDereham changed the title WIP: Update to gpiozero Update to gpiozero Jun 5, 2017
@WillDereham
Copy link
Contributor Author

Finished and tested.

@WillDereham WillDereham mentioned this pull request Jun 5, 2017
@MarcScott MarcScott merged commit 7b507e1 into raspberrypilearning:master Jun 6, 2017
@WillDereham WillDereham deleted the gpiozero branch June 6, 2017 07:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants