Skip to content

Commit

Permalink
Stop notifier in examples (#1814)
Browse files Browse the repository at this point in the history
  • Loading branch information
zariiii9003 authored Jul 11, 2024
1 parent c87db06 commit acc90c6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions examples/print_notifier.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
#!/usr/bin/env python

import time

import can


def main():
with can.Bus(receive_own_messages=True) as bus:
with can.Bus(interface="virtual", receive_own_messages=True) as bus:
print_listener = can.Printer()
can.Notifier(bus, [print_listener])
notifier = can.Notifier(bus, [print_listener])

bus.send(can.Message(arbitration_id=1, is_extended_id=True))
bus.send(can.Message(arbitration_id=2, is_extended_id=True))
bus.send(can.Message(arbitration_id=1, is_extended_id=False))

time.sleep(1.0)
notifier.stop()


if __name__ == "__main__":
Expand Down
1 change: 1 addition & 0 deletions examples/vcan_filtered.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def main():
bus.send(can.Message(arbitration_id=1, is_extended_id=False))

time.sleep(1.0)
notifier.stop()


if __name__ == "__main__":
Expand Down

0 comments on commit acc90c6

Please sign in to comment.