コード例 #1
0
def deviceWrite(array_WriteVal):
    index = int(0)
    priority = int(1)
    writeVal = array_WriteVal
    for count in array_WriteVal:
        #print count, array_ObjType[count], array_Port[count],array_PropId[count], writeVal[count]
        write(str(array_ObjType[count]), int(array_Port[count]),str(array_PropId[count]), float(writeVal[count]), index, priority)
コード例 #2
0
obj_type = 'analogInput'
obj_inst = int(2)
prop_id = 'presentValue'
ini_name = 'BACpypes'

doStart(ini_name)

confirmationValue = read(obj_type, obj_inst, prop_id)
print "Current Temperature: " + str(confirmationValue) + "\n"


obj_type = 'analogOutput'
obj_inst = int(3)
value = float(2)
index = int(0)
priority = int(1)

time.sleep(1)

confirmationValue = write(obj_type, obj_inst, prop_id, value, index, priority)
print "Write: " + str(confirmationValue)

value = float(0)

print "Lighting LED for 10 seconds\n"
time.sleep(10)
confirmationValue = write(obj_type, obj_inst, prop_id, value, index, priority)
print "Write: " + str(confirmationValue)

doStop()
コード例 #3
0
                tablename = table.lower()
                print tablename
                insertNewRow(tablename, valDic)
               
                 #manipulate data
                for item in range(1,numberOfConnectedPorts):
                    portObj = here.getPortItem(item)
                    if portObj.getControlled():
                        manipulatedDic[portObj.getConnectedTo()] = portObj.Ploop(setpoint, readDic[portObj.getPortNum()])     #manipulatedDic should conatin the value from the Ploop with the key being the port of the actuator that the sensor is paired with
                print "after Ploop : " + str(manipulatedDic)
                        
                start2 = time.time()            ################################
                #print "Started write ..."
                for item in manipulatedDic:
                    portObj = here.getPortItem(item)
                    write(here, portObj, manipulatedDic[item])      
                end2 = time.time()              ################################

            
            
           # else:
           #     print 'An error has been captured: ' + str(started) + ", " + here.getObjectName()  + "\n\n"
            
        except ComputerNotConnectedToIP, exc:
            print exc 
        
        except:    
            print "You found a new error. Congrats!\n\n" #+ str(e)
        
        finally:
            if started == True:
コード例 #4
0
import time

obj_type = 'analogInput'
obj_inst = int(2)
prop_id = 'presentValue'
ini_name = 'BACpypes'

doStart(ini_name)

confirmationValue = read(obj_type, obj_inst, prop_id)
print "Current Temperature: " + str(confirmationValue) + "\n"

obj_type = 'analogOutput'
obj_inst = int(3)
value = float(2)
index = int(0)
priority = int(1)

time.sleep(1)

confirmationValue = write(obj_type, obj_inst, prop_id, value, index, priority)
print "Write: " + str(confirmationValue)

value = float(0)

print "Lighting LED for 10 seconds\n"
time.sleep(10)
confirmationValue = write(obj_type, obj_inst, prop_id, value, index, priority)
print "Write: " + str(confirmationValue)

doStop()