人体红外传感器 - 图1

python 编程:

创建实例

  • human(port_num)
    创建human实例,port_num 可取值为 thunbot.PORT_1, thunbot.PORT_2,thunbot.PORT_3, thunbot.PORT_4,thunbot.PORT_A,thunbot.PORT_B

    方法

  • get_status()
    获取传感器感应结果,如果人或物体移动,返回”1”,否则返回”0”

编程示范

  1. import thunbot
  2. import time
  3. h3 = thunbot.human(thunbot.PORT_3)
  4. while True:
  5. print(h3.get_status())
  6. time.sleep(1)