I have a robot that is moving when it received the CAN message. So, on the robot side I have only one Port for CAN message receiving but I am giving the CAN message from two difference controller, one is from Arduino that receives message from a remote controller and the 2nd is from my laptop thatbconnect with a CAN to UsB cable. What i want to switch between these two messages. For now i am always changing the CAN cable manually. I want to know that is there any CAN switch available or any other way to switch???
Now I am trying to changing the port everytime.
All you need is to connect all devices in one CAN network. Note that only two terminators (resistors) shall be there. Your network should look like this:
+---------+--------+---------+--------+ CAN_H
[120Ω] | | | [120Ω]
+----------+--------+---------+-------+ CAN_L
|| || ||
Robot Arduino Laptop
You might configure each device in a different way, for example:
If both Arduino and laptop would try to control your robot at the same time, it would get duplicated or requests in contradiction. Also it might cause errors on CAN network. I strongly recommend to avoid situations with two devices simulating the same CAN node at the same time as it might cause undefined behavior, CAN devices go to ERROR state or even damage to your robot.
This question is not code related, so it does not belong to Stackoverflow (check other spaces for more suitable one).