class
Scheduled
An action set for an exact simulated time, as Board.do(..., at=), Board.send_serial and Board.scheduled return it.
from hardlabs_sdk import ScheduledThe board works it at that instant, with simulated time standing still, so it lands at the same point of the firmware's run however fast the server is. refresh reads what has happened to it since.
Attributes
idstr- Its id on the board.
kindstrcontrolorserial.statusstrarmed(waiting for its trigger),pending,fired,failedorcancelled.controlstr | None- The control it works.
serialstr | None- The serial port it writes to.
atfloat | None- When it acts, in simulated seconds since the board booted (a trigger's once it matched).
whendict | None- Its trigger.
matched_atfloat | None- When its trigger matched.
fired_atfloat | None- When it acted.
outputstr | None- The control's output.
errorstr | None- Why it failed.
late_byfloat | None- How long after
atit acted, when the board had already passedatby the time it was set. notestr | None- How its trigger is watched, when that matters.
after_pressstr | None- For a button's release, the id of the press it follows.
Scheduled.doneproperty
Whether it is over: fired, failed or cancelled.
action.done -> boolScheduled.refreshmethod
Reads its state from the board again.
action.refresh() -> ScheduledReturns
Scheduled — Itself, updated.
Scheduled.cancelmethod
Cancels it if it hasn't happened yet (and a button's pending release).
action.cancel()Scheduled.waitmethod
Waits until it has happened.
action.wait(within=30.0) -> ScheduledArguments
withinfloatdefault 30.0- Simulated seconds to wait.
Returns
Scheduled — Itself, fired.
Raises
- AssertionError — It didn't happen within that time, or it failed.
- RuntimeError — The board is held (
Board.hold), so time won't reach it: run it withBoard.run_until.