I am using an arduino UNO and a Cooking Hacks CAN BUS module through a Cooking Hacks Multiprotocol radio shield. I plan to read the CAN messages through the car's OBD-II port. I have connected the components according to the tutorial and though there is no LED to indicate that the shield and CAN bus module are ON, I verified that they are indeed ON by using a multimeter. Also, when the reset button is pressed on either the shield or the CAN module, the arduino resets so I guess they are powered up. Coming to my problem, I uploaded the code and connected the setup to the OBD-II port and turned the ignition ON. I expected to see the CAN messages on the arduino serial monitor but I didn't see anything. I also took up this issue with the cooking hacks support team who told me that the libraries were updated and that I should use the updated ones. So I downloaded the revised libraries to use with my code but I am unable to upload the code itself to the arduino because of an error during compilation.
C:\Users\user\Documents\Arduino\libraries\arduinoCANBUS\arduinoCAN.cpp:26:49: fatal error: ../arduino-api/arduinoMultiprotocol.h: No such file or directory
The major difference as far as I can tell between the old and the new libraries is the addition of two lines in the arduinocan.cpp file : #include "../arduino-api/arduinoMultiprotocol.h" #include "../arduino-api/arduinoUtils.h" Both of these are header files in another library that was included as part of the whole library that you can download from their website.
I realise I might have confused whoever's reading but please have a look at the arduino code. Hopefully, that should clear things up. Any help would be highly appreciated. Thanks.
Code:
#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);
}
}