1

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);
     }
    }  

EDIT: PROBLEM SOLVED!

Putting the header file's full path in the sketch did not solve it. The compiler still displayed the same error. I then made a backup copy of all the files containing the #include "arduinoMultiprotocol.h" statement and edited them to contain the full path. Initially, the error didn't change and I moved onto the next suggestions, all of which did not change the error. However, I went back to the edited files and replaced the backslash() with the slash(/). This time, the compiler did not throw the same error, instead saying it cannot find arduinoUtils.h. So I proceeded to do the same thing with arduinoUtils.h, editing all the files containing it to mention the full path. And this time it worked and the sketch works as well. Thanks for your help!

  • We have a SE site specifically devoted to Arduino-specific issues. Migrating. – Dave Tweed Feb 10 '16 at 13:03
0

The compiler is saying it can't find the header files. The part of the path ../arduino-api/ is suspicious.

It may be because the header files are expected to be somewhere else, or their is a small error which has had a knock on effect.

1 - Find arduinoMultiprotocol.h
Put its full path into the include statement, e.g.

    #include "C:\Users\user\Documents\Arduino\libraries\arduinoCANBUS\wibble\arduinoMultiprotocol.h"

If that is still broken, but a new error is printed, copy the error. If the error doesn't change, then make a backup copy of every file you can find containing #include <arduinoMultiprotocol.h> and edit it to contain the full path. It looks like starting with arduinocan.cpp is a good place to start.

2 - If that doesn't fix the error, create an empty sketch, including all those headers, e.g.

    #include <arduinoCAN.h>
    #include <arduinoClasses.h>
    #include <arduinoMultiprotocol.h>
    #include <arduinoUART.h>
    #include <arduinoUtils.h>
    #include <Wire.h>
    #include <SPI.h>

    void setup() { }

    void loop() { }

Compile and copy the error message. Move the #include <arduinoMultiprotocol.h> a bit later in the sequence of #includes. If the error changes copy that for later, and record which sequence changed it.

3 - Change #include <arduinoMultiprotocol.h> in that empty sketch to the full path (as in step 1). If that doesn't fix it, copy that error message.

If you still need help, please update your question with the results of those tests.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.