Advertisement
sxiii

SolarHub Alpha

Jan 9th, 2018
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.88 KB | None | 0 0
  1. #!/usr/bin/python
  2. from appJar import gui
  3. from time import sleep
  4. import serial
  5. import numpy as np
  6.  
  7. def press(btn):
  8.     print(btn)
  9.  
  10. app = gui("MetaSolar HUB GUI","1280x720")
  11. ser = serial.Serial("/dev/ttyS0", 115200, serial.EIGHTBITS, serial.PARITY_NONE, serial.STOPBITS_ONE, timeout=1)
  12.  
  13. ser.write(b'\x00\x34'); app.setFont("16");
  14. app.setSticky("news");
  15. app.setExpand("both")
  16.  
  17. #app.addLabel("l1", "Some text", 0)
  18. app.addButton("One", press)
  19.  
  20. app.addLabel("l2", "1", 0, 1)
  21. app.addLabel("l3", "2", 1, 0, 2)
  22. #app.setLabelBg("l1", "red");
  23. app.setLabelBg("l2", "blue");
  24. app.setLabelBg("l3", "green");
  25. #app.getLabelWidget("l3").config(font=("","26",""))
  26.  
  27. sleep(0.1)
  28.  
  29. x=ser.read(80)
  30. words = x.split("\r\n")
  31.  
  32. for x in range(0, 12):
  33.     words[x] = float(words[x])
  34.  
  35. words.remove('');
  36.  
  37. #app.addLabel("data",words[0]*2)
  38. app.setLabel("l3",words)
  39.  
  40. ser.close()
  41.  
  42. app.go()
  43. #sleep(5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement