Created
February 6, 2014 06:48
-
-
Save Bolt64/8839401 to your computer and use it in GitHub Desktop.
Threading for a raspberry pi bot
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
#!/usr/bin/env python3 | |
import threading | |
class led_thread(threading.Thread): | |
def run(self): | |
print('Doing led stuff') | |
#Other stuff | |
class listener_thread(threading.Thread): | |
def run(self): | |
print('Listening') | |
#Other stuff | |
def main(): | |
leds=led_thread() | |
listener=listener_thread() | |
leds.start() | |
listener.start() | |
leds.join() | |
listener.join() | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment