Created
November 27, 2017 22:04
-
-
Save JosephGregg/7f87c8a24899dcdbaae108c8889e0774 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
from roboclaw import Roboclaw | |
rc = Roboclaw("/dev/ttyACM0",115200) | |
rc.Open() | |
voltage = rc.ReadMainBatteryVoltage(0x80) | |
if voltage[0]==False: | |
print "GETVOLTAGE Failed" | |
else: | |
print "Battery is at " + repr(float(voltage[1]) / 10) + "V" | |
time.sleep(1) | |
temperature = rc.ReadTemp(0x80) | |
print "RoboClaw temperature reading is " + repr(float( round(temperature[1] / 10 * 9 / 5 + 32,2) )) + "F" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment