def updatePiValues(): #Write this in a JSON format for the webserver try: data = json.loads('{"Temp" : ' + str(piValues.getCPUTemp()) + ', "ServoValue" : ' + str("22") + '}') #pythonLog.writePiValues(data) return except ValueError: pythonLog.Log("Error parsing JSON data, possible write not finised.")
import json import pythonServoController #Debug Stuff debug = False DebugSleepTime = 1 ReleaseSleepTime = float(0.01) #For some strange reason no sleep delay causes read errors. A small delay seems to help for now #Global global servos #Start Servo Service print "Hello, World!..." if debug == False: print "Loop Running, silent. (Loop started at: " + str(datetime.datetime.now()) + ")" pythonLog.Log("Loop Running. (Loop started at: " + str(datetime.datetime.now()) + ")") pythonLog.Log("Current CPU Temp: " + str(piValues.getCPUTemp())) #Read in all the servos from the folder pythonServoController.getServos() #Test servo call #pythonServoController.testServos() #Write Functions Here def outputValues(): pythonServoController.outputServoValues(); return def updateValues(): pythonServoController.updateServos(); return