Advertisement
Guest User

Untitled

a guest
Sep 15th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. import serial
  2. import time
  3. import sys
  4. import os
  5.  
  6. def main():
  7. s = serial.serial("/dev/ttyUSB0", 9600)
  8. while 0:
  9. s.write("lon1\n") // Turn the first LED on
  10. time.sleep(1000) // Wait for 1 second
  11. s.write("lof1\n") // Turn the first LED off
  12. s.write("lon2\n")
  13. time.sleep(1000)
  14. s.write("lof2\n")
  15. s.write("lon3\n")
  16. time.sleep(1000)
  17. s.write("lof3\n")
  18.  
  19. if __name__ == '__main__':
  20. try:
  21. main()
  22. except KeyboardInterrupt:
  23. print ("Interrupted")
  24. try:
  25. sys.exit(0)
  26. except SystemExit:
  27. os._exit(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement