这是本文档旧的修订版!
====== TactRow ====== 轻触开关组类,读取单个轻触开关的状态。 ===== 方法 ===== ==== __init__(self, pin, real_true = GPIO.HIGH) ==== 初始化对象,设置引脚和触发电平(高电平或低电平触发)。pins 为 IO 引脚数组。 ==== is_on(self, index) ==== 返回当前轻触开关的按下状态。true 或 false。index 为 LED 编号,从 0 开始。 ==== row_status(self) ==== 返回当前轻触开关组的工作状态的数组。 ==== items(self) ==== 返回当前轻触开关组的对象数组。 调用方法: <code> tact_event_handler = None def on_tact_event(self, pin, status): #print('on_tact_event') if self.tact_event_handler is not None: self.tact_event_handler(pin, status) def tact_event_handler(pin, status): ''' called while the status of tacts changed :param pin: pin number which stauts of tact is changed :param status: current status :return: void ''' print('tact_event_handler') print("%d - %s" % (pin, status)) SAKS.tact_event_handler = tact_event_handler </code>