Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <arduinoCAN.h>
- #include <arduinoClasses.h>
- #include <arduinoMultiprotocol.h>
- #include <arduinoUART.h>
- #include <arduinoUtils.h>
- #include <Wire.h>
- #include <SPI.h>
- // Create an instance of the object
- CAN myCAN = CAN();
- // Setting up our devices and I/Os
- void setup() {
- // Using the Socket 0 onto which Can bus module is plugged in
- Utils.setONSocket0();
- Utils.setMUXSocket0();
- // Initializes the UART
- Serial.begin(115200);
- delay(100);
- myCAN.begin(500); // Start talking to the BUS. Speed= 500 Kbps
- }
- void loop() {
- // 1. Receive data
- if (myCAN.messageAvailable()) {
- // Read the last message received.
- myCAN.getMessage(&myCAN.messageRx);
- // Print in the serial monitor the received message
- myCAN.printMessage(&myCAN.messageRx);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement