示例#1
0
 def POST(self):
     data = webdotpyparselib.webdataintodict(
         webdotpyparselib.webdataintoascii(web.data()))
     if len(data["id"]) < 1:
         return json.dumps({
             "success":
             False,
             "message":
             "No ID number was passed to this function."
         })
     data["id"] = int(data["id"])
     try:
         result = ardustatlibrary.blink(portconstant + data["id"])
     except:
         if enabledebugging == True: raise
         return json.dumps({
             "success": False,
             "message": "Blinking LED failed unexpectedly."
         })
     else:
         if result["success"] == True:
             return json.dumps({
                 "success":
                 True,
                 "message":
                 "Blinked LED:\n" + result["message"]
             })
         else:
             return json.dumps({
                 "success":
                 False,
                 "message":
                 "Blinking LED failed with message:\n" + result["message"]
             })
示例#2
0
	def POST(self):
		data = webdotpyparselib.webdataintodict(webdotpyparselib.webdataintoascii(web.data()))
		if len(data["id"]) < 1:
			return json.dumps({"success":False,"message":"No ID number was passed to this function."})
		data["id"] = int(data["id"])
		try:
			result = ardustatlibrary.blink(portconstant+data["id"])
		except:
			if enabledebugging == True: raise
			return json.dumps({"success":False,"message":"Blinking LED failed unexpectedly."})
		else:
			if result["success"] == True:
				return json.dumps({"success":True,"message":"Blinked LED:\n"+result["message"]})
			else:
				return json.dumps({"success":False,"message":"Blinking LED failed with message:\n"+result["message"]})		
示例#3
0
import ardustatlibrary as ard
import time
the_socket = 7777

connresult = ard.connecttosocket(the_socket)

print connresult

socketinstance = connresult["socket"]

for a in range(0,5):
	ard.blink(the_socket)
	time.sleep(.2)

示例#4
0
import ardustatlibrary as ard
import time
the_socket = 7777

connresult = ard.connecttosocket(the_socket)

print connresult

socketinstance = connresult["socket"]

for a in range(0, 5):
    ard.blink(the_socket)
    time.sleep(.2)