|
Post by windy54 on Sept 24, 2014 11:55:16 GMT -8
Hi
I am using raspiconnect to controlmy robot. i want to add a live slider control to vary the default motor settings.
i can see how to send the current value back to the screen but can't see how to extract the new value at the raspberry PI.
can someone please give me a pointer, I have not been able to find an example file anywhere
cheers
Steve
|
|
|
Post by SDL on Sept 24, 2014 18:33:04 GMT -8
Hi Steve, Here is a snippet from Faraday's program BeaconAir. The article is in Raspberry PI Geek magazine and the source code is at: github.com/switchdoclabs/BeaconAirRasPiConnectLocalHe has a great tutorial on using RasPiConnect at switchdoc.com at www.switchdoc.com/2014/07/build-control-panels-tutorial-raspiconnect/ although he doesn't specifically address the Slide Control in the article. He does use the slide control in BeaconAir: www.switchdoc.com/2014/06/beaconair-lives-control-panel/Let us know if we can be of more help! Post a picture of your control screen in the User Projects section! We'd love to see it. Best regards, BP # SL-2 - Brightness Sensitivity in meters if (objectServerID == "SL-2"):
#check for validate request # validate allows RasPiConnect to verify this object is here if (validate == "YES"): outgoingXMLData += Validate.buildValidateResponse("YES") outgoingXMLData += BuildResponse.buildFooter() return outgoingXMLData
# normal response requested commandresponse = objectAction if (float(commandresponse) < 0.15): try: f = open("/home/pi/BeaconAir/state/brightnessSensitivity.txt", "r") commandresponse = f.read() f.close() except: commandresponse = "2.0"
f = open("/home/pi/BeaconAir/state/brightnessSensitivity.txt", "w") f.write(commandresponse) f.close() status = sendCommandToBeaconAirAndWait("UPDATESENSITIVITIES") # Not LIVE values, just send "" back commandresponse = "" outgoingXMLData += BuildResponse.buildResponse(commandresponse)
outgoingXMLData += BuildResponse.buildFooter() return outgoingXMLData
|
|
|
Post by windy54 on Sept 25, 2014 0:34:01 GMT -8
That is just what I am after, the statement "command response =objectaction"
I had looked at some of the projects but could not spot a slider example.
I will post my screen when completed, I am using the BrickPI to control a lego robot with a distance and compass fitted.
Thanks for the response
Steve
|
|