return rtn if __name__ == '__main__': argvs = sys.argv if (len(argvs) <= 1): tpUtils.stderr('Need argv! [1]: slot') sys.exit(0) try: slot = argvs[1] host = None if (len(argvs) > 2): host = argvs[2] tp31 = Tp31(slot, host) except Exception as e: tpUtils.stderr(str(e.args)) sys.exit(0) while True: try: data = input() recv_data = tp31.send(data) tpUtils.nodeOut(json.dumps(recv_data)) except KeyboardInterrupt: sys.exit(0) except Exception as e: tpUtils.stderr(str(e.args)) tpUtils.nodeOut("")
if __name__ == '__main__': argvs = sys.argv if (len(argvs) <= 1): tpUtils.stderr('Need argv! [1]: slot') sys.exit(0) try: slot = argvs[1] host = None if (len(argvs) > 2): host = argvs[2] tp54 = Tp54(slot, host) tp54.start() except Exception as e: tpUtils.stderr(str(e.args)) sys.exit(0) while True: try: data = input() recv_data = tp54.send(data) tpUtils.nodeOut(recv_data.decode('utf-8')) except KeyboardInterrupt: sys.exit(0) except Exception as e: tpUtils.stderr(str(e.args)) tpUtils.nodeOut("")
if __name__ == '__main__': argvs = sys.argv if (len(argvs) <= 1): tpUtils.stderr('Need argv! [1]: slot') sys.exit(0) try: slot = argvs[1] host = None if (len(argvs) > 2): host = argvs[2] tp53 = Tp53(slot, host) tp53.start() except Exception as e: tpUtils.stderr(str(e.args)) sys.exit(0) while True: try: data = input() recv_data = tp53.get_data(data) tpUtils.nodeOut(recv_data) except KeyboardInterrupt: sys.exit(0) except Exception as e: tpUtils.stderr(str(e.args)) tpUtils.nodeOut("")
argvs = sys.argv if (len(argvs) <= 1): tpUtils.stderr('Need argv! [1]: slot') sys.exit(0) try: slot = argvs[1] host = None if (len(argvs) > 2): host = argvs[2] tpgGestureSensor = TpgGestureSensor(slot, host) except Exception as e: tpUtils.stderr(str(e.args)) sys.exit(0) while True: try: time.sleep(.1) ges = tpgGestureSensor.return_gesture() if (ges is not None): tpUtils.nodeOut(ges) except KeyboardInterrupt: sys.exit(0) except Exception as e: tpUtils.stderr(str(e.args)) tpUtils.nodeOut("") # I2Cをループで取得するのでエラー時はWAITを入れる time.sleep(2)