Beispiel #1
0
def customCallback(client, userdata, message):
    print("Motor Run: ")
    rgb.blueOff()
    rgb.cyanOn()
    motor_runner.pulse(5)
    rgb.cyanOff()
    rgb.blueOn()
    print(userdata)
    print("--------------\n\n")
Beispiel #2
0
def physical_button_press():
    rgb.cyanOff()
    rgb.whiteZero()
    print("Motor Run: ")
    print("Button was pushed!")
    message = {}
    message['action']     =  "feedActivity"
    message['data'] = "1" 
    message['type'] = "buttonDrop"
    message['quantity_dropped']  = "150"
    message['food_remaining_container'] = "300"
    message['timeStamp']=time.asctime( time.localtime(time.time()) )
    messageJson = json.dumps(message)
    myAWSIoTMQTTClient.publish("device", messageJson, 0)
    print('Published topic %s: %s\n' % (topic, messageJson))
    motor_runner.pulse(5)
    rgb.whiteOff()
    rgb.cyanSlow();
    print("--------------\n\n")
Beispiel #3
0
def sch_drop():
    rgb.cyanOff()
    rgb.whiteZero()
    print("Motor Run: ")
    print("schedule drop!")
    motor_runner.pulse(5)
    message = {}
    message['action']     =  "feedActivity"
    message['data'] = "1" 
    message['type'] = "scheduleDrop"
    message['scheduleTime'] = "[7:20]"
    message['quantity_dropped']  = "150"
    message['food_remaining_container'] = "300"
    message['autoFeed'] = "1"
    message['timeStamp']=time.asctime( time.localtime(time.time()) )
    messageJson = json.dumps(message)
    myAWSIoTMQTTClient.publish("device", messageJson, 0)
    print('Published topic %s: %s\n' % (topic, messageJson))
    rgb.whiteOff()
    rgb.cyanSlow();
    print("--------------\n\n")
Beispiel #4
0
def run_motor(self, params, packet):
    motor_runner.pulse(2)
    myMQTTClient.publish('home/motorRunStatus', packet.payload, 0)