def on_message(client, userdata, msg): print('Msg received...') print(msg.topic + ' ' + str(msg.payload)) print(msg.payload.decode()) color_str = str(msg.payload.decode()) if color_str == 'GREEN': motor.setSpeed(50) motor.start()
def bySize(form, setLabelSignal): print(form.area) if (form.area <= 10000): print("Small") sleep(1) right() sleep(1) start() setLabelSignal.emit("Small") if (form.area > 10000): print("Big") sleep(1) right() sleep(1) start() setLabelSignal.emit("Big")
def byForm(form, setLabelSignal): if form.corners == 4: print("Patrulater") sleep(1) left() sleep(1) start() setLabelSignal.emit("Patrulater") if form.corners == 3: print("Triunghi") sleep(1) right() sleep(1) start() setLabelSignal.emit("Triunghi") if form.corners == 6: print("Hexagon") setLabelSignal.emit("Hexagon")
def start_clicked(self): print("Start clicked") start() self.thread = MyThread(self.stopFlag, self.updateImageSignal, self.mode, self.setLabelSignal) self.startThread()
import os import glob import time import sys import motor #import pigpio as gpio #pi = gpio.pi() frequency = sys.argv[1] #direction = sys.argv[2] #enable = sys.argv[3] #while (True): motor.start(frequency)