Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import serial
- import time
- import sys
- import os
- def main():
- s = serial.serial("/dev/ttyUSB0", 9600)
- while 1:
- s.write("lon1\n") // Turn the first LED on
- time.sleep(1000) // Wait for 1 second
- s.write("lof1\n") // Turn the first LED off
- s.write("lon2\n")
- time.sleep(1000)
- s.write("lof2\n")
- s.write("lon3\n")
- time.sleep(1000)
- s.write("lof3\n")
- if __name__ == '__main__':
- try:
- main()
- except KeyboardInterrupt:
- print ("Interrupted")
- try:
- sys.exit(0)
- except SystemExit:
- os._exit(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement