-
-
Save JeffersGlass/abfdce24cde5bd145c204bb532a84ad0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import the LED object from the gpiozero module | |
from gpiozero import LED | |
#import the 'sleep' function from the time module | |
from time import sleep | |
#Create a new instance of the LED class, with the parameter '20' | |
redLed = LED(20) | |
#Call the 'on' method of the redLed instance, which is given no arguments | |
redLed.on() | |
#call the 'sleep' function that we imported from the time module. | |
#Notice the lack of a a period or dot - this is just a regular old | |
#Function that we're calling, not the method of an object | |
sleep(1) | |
#call the off method of the redLed object, again with no arguments | |
redLed.off() | |
sleep(1) | |
#call the 'blink' method of the redLed object, this time with two arguments | |
#These are both keyword arguments | |
redLed.blink(on_time=.2,off_time=.8) | |
sleep(5) | |
redLed.off() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment