Last active
December 21, 2020 04:08
-
-
Save alan707/f954ce02eb4a2134e2ea66d64331ec46 to your computer and use it in GitHub Desktop.
Simple Python CAN Bridge (a.k.a CAN Gateway)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import can | |
from time import sleep | |
can_bus_a = can.Bus('can0', bustype='socketcan') | |
can_bus_b = can.Bus('can1', bustype='socketcan') | |
try: | |
for message in can_bus_a: | |
can_bus_b.send(message) | |
while True: | |
sleep(1) | |
except KeyboardInterrupt: | |
print("\nProgram Ended") | |
exit(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment