Skip to content

Include example of how alarm.time() is used in code.py #7743

Open
@kattni

Description

@kattni

The documentation for alarm.time() should include an example that shows what it looks like in use in code.py. I struggled to figure out how to format it, and ultimately asked for help. I believe this would eliminate potential confusion for others moving forward.

The following explanation and example should be fine to include in the alarm.time() documentation.

This code block sets a delay, creates a TimeAlarm to wake up the board after delay seconds have passed, and then deep sleeps the board until the time alarm is triggered in 30 seconds.

delay = 30  # delay is in seconds
time_alarm = alarm.time.TimeAlarm(monotonic_time=time.monotonic() + delay)
alarm.exit_and_deep_sleep_until_alarms(time_alarm)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions