Thu, 16 Feb 2017 16:24:52 +0100
gnf..... merge
--- a/analgauge.py Thu Feb 16 14:50:25 2017 +0100 +++ b/analgauge.py Thu Feb 16 16:24:52 2017 +0100 @@ -1,8 +1,11 @@ import usb.core from psutil import cpu_percent +from time import sleep +from random import random +from sys import exit -VALUE_MIN = 0x00 -VALUE_MAX = 0x88 +#VALUE_MIN = 0x00 # TODO +VALUE_MAX = 0x7B VENDOR_ID = 0x16c0 PRODUCT_ID = 0x05df @@ -13,6 +16,9 @@ idVendor = VENDOR_ID, idProduct = PRODUCT_ID ) + if not self.dev: + print "AnalGauge Device not found!" + exit(1) def update(self, d): try: @@ -28,6 +34,14 @@ if __name__ == "__main__": g = AnalGauge() + + #g.update(VALUE_MAX) + #exit() + + #while True: + # g.update(random() * VALUE_MAX) + # sleep(0.5) + while True: pct = cpu_percent(interval=1) g.update((VALUE_MAX * pct)/100)