I have an Arduino Uno connected to a printed circuit board that has a BME 280 commercial environmental sensor attached (see here) to measure the ambient pressure, temperature, and relative humidity. The C++ code that controls the BME sensor on the Arduino was obtained from here. It also requires you to download this. I can access the data through the Arduino IDE, but I want to be able to do everything in MATLAB as well. Basically, the question is, how can I command MATLAB to read from this sensor when it's not directly connected to any of the Arduino board output pins?
The process for setting up the MATLAB-Arduino connection is described here. The first step (add-on package folder) is easy enough. The second step (MATLAB add-on class) pretty confusing. The last step (C++ header file) I can't understand at all, since it's been a very long time since I used C++ regularly. I'll go in order to keep things simple, so first I'll ask questions about the MATLAB add-on class file (this):
- What are the "dependent libraries"? Are those the lines at the beginning of the .h file (there's "Arduino.h", "WProgram.h",
and ). Am I supposed to list those in the DependentLibaries line? Where are these files in the first place, i.e. does MATLAB need to know where to look for somehow? If I was forced to guess, I'd leave this part blank, but I wanted to be sure.
- I think "ArduinoLibraryHeaderFiles" is where you list
, but how does MATLAB know where to look for this other .h file? Do I create another add-on package folder, even if I don't use it directly? Also, calls its own .h files (namely, and "Print.h"). What should I do about those?
- Can the Resource Owner and Destructor things be ignored in my case? I would assume yes.
- The GitHub link includes a .cpp file and a .h file. The .h file goes in the add-on package folder, but what do I do with the .cpp file? Am I supposed to transfer all of its processes and calculations (where it converts the voltage reading to temperature and pressure) to the .h file?
Any help would be greatly appreciated.