Merge branch 'master' of github.com:jamesbowman/i2cdriver

This commit is contained in:
James Bowman 2019-03-17 18:49:31 -07:00
commit c8566b9516
2 changed files with 21 additions and 1 deletions

View File

@ -36,7 +36,13 @@ On Linux cross-compile ``i2ccl``:
cd c
make -f win32/Makefile
On Windows build the GUI executable using ``pyinstaller``:
On Windows first make sure that you can run the GUI on the command-line, e.g.
python python\samples\i2cgui.py
(You may need to install i2cdriver, wxPython and pySerial).
Then build the GUI executable using ``pyinstaller``:
cd python\samples
pyinstaller --onefile --windowed --icon=../../images/i2cdriver.ico i2cgui.py

View File

@ -0,0 +1,14 @@
import sys
import time
from i2cdriver import I2CDriver, EDS
if __name__ == '__main__':
i2 = I2CDriver(sys.argv[1])
d = EDS.Temp(i2)
for i in range(20):
celsius = d.read()
fahrenheit = celsius * 9/5 + 32
sys.stdout.write("%.1f C %.1f F\n" % (celsius, fahrenheit))
time.sleep(.1)