alarm.pin
– Trigger an alarm when a pin changes state.¶
- class alarm.pin.PinAlarm(pin: microcontroller.Pin, value: bool, edge: bool = False, pull: bool = False)¶
Create an alarm triggered by a
microcontroller.Pin
level. The alarm is not active until it is passed to analarm
-enabling function, such asalarm.light_sleep_until_alarms()
oralarm.exit_and_deep_sleep_until_alarms()
.- Paramètres:
pin (microcontroller.Pin) – The pin to monitor. On some ports, the choice of pin may be limited due to hardware restrictions, particularly for deep-sleep alarms.
value (bool) – When active, trigger when the pin value is high (
True
) or low (False
). On some ports, multiplePinAlarm
objects may need to have coordinated values for deep-sleep alarms.edge (bool) – If
True
, trigger only when there is a transition to the specified value ofvalue
. IfTrue
, if the alarm becomes active when the pin value already matchesvalue
, the alarm is not triggered: the pin must transition fromnot value
tovalue
to trigger the alarm. On some ports, edge-triggering may not be available, particularly for deep-sleep alarms.pull (bool) – Enable a pull-up or pull-down which pulls the pin to the level opposite that of
value
. For instance, ifvalue
is set toTrue
, settingpull
toTrue
will enable a pull-down, to hold the pin low normally until an outside signal pulls it high.
- pin :microcontroller.Pin¶
The trigger pin.
- value :bool¶
The value on which to trigger.