M2 SWCAN Point to Point
Send a SWCAN frame between 2 M2's.
Last updated
Send a SWCAN frame between 2 M2's.
Last updated
2x M2
1x 12V power supply
Upload THIS SKETCH to one M2, and THIS SKETCH to the other.
The first sketch is the transmitter and sends a non extended frame and blinks a light quickly when button 1 is pressed, and sends an extended frame and blinks a light slowly when button 2 is pressed.
The second sketch is the receiver and prints any SWCAN frames it receives to the serial monitor. It also blinks an LED corresponding to whether or not the frame is extended.
Both sketches are based on the SWCAN MCP2515 library which can be installed from the link below:
Connect both M2's and OBD3way board as shown below. This connects the SWCAN of one M2 to the SWCAN of the other.
Try pressing button 1 on the transmitter M2; both it and the other M2 should blink quickly as the frame is sent and received, respectively. If your receiving M2 is connected to a serial monitor the frame data will be printed there as well. Try pressing button 2 to send an extended frame. The same thing should happen with a slower blink indicating an extended frame.