Skip to content

Instantly share code, notes, and snippets.

@JosephGregg
Created November 27, 2017 22:04
Show Gist options
  • Save JosephGregg/7f87c8a24899dcdbaae108c8889e0774 to your computer and use it in GitHub Desktop.
Save JosephGregg/7f87c8a24899dcdbaae108c8889e0774 to your computer and use it in GitHub Desktop.
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