Skip to content

Commit dd2c075

Browse files
authored
fix(components/board): update stream ticks example doc (#612)
1 parent 20b2c6f commit dd2c075

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/viam/components/board/board.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -382,11 +382,13 @@ async def stream_ticks(self, interrupts: List[DigitalInterrupt], *, timeout: Opt
382382
di8 = await my_board.digital_interrupt_by_name(name="8"))
383383
di11 = await my_board.digital_interrupt_by_name(name="11"))
384384
385-
Stream ticks from pins 8 and 11.
386-
ticks = my_board.stream_ticks([di8, di11])
385+
# Iterate over stream of ticks from pins 8 and 11.
386+
async for tick in my_board.stream_ticks([di8, di11]):
387+
print(f"Pin {tick.pin_name} changed to {'high' if tick.high else 'low'} at {tick.time}")
388+
387389
388390
Args:
389-
interrupts (List[DigitalInterrupt]) : list of digital interrupts to recieve ticks from.
391+
interrupts (List[DigitalInterrupt]) : list of digital interrupts to receive ticks from.
390392
391393
Returns:
392394
TickStream: stream of ticks.

0 commit comments

Comments
 (0)