RPICT8: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 12: | Line 12: | ||
[[File:IMG_1066_small.png]] | [[File:IMG_1066_small.png]] | ||
[[File:IMG_1067_small.png]] | [[File:IMG_1067_small.png]] | ||
===Python demo script=== | |||
First of all make sure you have python-serial package installed | |||
$ sudo apt-get install python-serial | |||
Then copy the following into an executable file and run it. | |||
#!/usr/bin/python | |||
import serial | |||
ser = serial.Serial('/dev/ttyAMA0', 38400) | |||
try: | |||
while 1: | |||
response = ser.readline() | |||
z = response.split(",") | |||
if len(z)>=7: | |||
print "Power 1: %s Watts" % z[0] | |||
print "Power 2: %s Watts" % z[1] | |||
print "Power 3: %s Watts" % z[2] | |||
print "Power 4: %s Watts" % z[3] | |||
print "Power 5: %s Watts" % z[4] | |||
print "Power 6: %s Watts" % z[5] | |||
print "Power 7: %s Watts" % z[6] | |||
print "Power 8: %s Watts" % z[7][:-2] | |||
except KeyboardInterrupt: | |||
ser.close() |
Revision as of 16:58, 17 May 2017
This page is for board specific information. More information can be found on the generic page for RPICT series.
This board is similar to RPICT7V1 version 2. RPICT8 is stackable on RPICT7V1's board.
Refer to the RPICT7V1 documentation for more details.
Python demo script
First of all make sure you have python-serial package installed
$ sudo apt-get install python-serial
Then copy the following into an executable file and run it.
#!/usr/bin/python import serial ser = serial.Serial('/dev/ttyAMA0', 38400) try: while 1: response = ser.readline() z = response.split(",") if len(z)>=7: print "Power 1: %s Watts" % z[0] print "Power 2: %s Watts" % z[1] print "Power 3: %s Watts" % z[2] print "Power 4: %s Watts" % z[3] print "Power 5: %s Watts" % z[4] print "Power 6: %s Watts" % z[5] print "Power 7: %s Watts" % z[6] print "Power 8: %s Watts" % z[7][:-2] except KeyboardInterrupt: ser.close()