I would like to use the SDFAT library in my application needing a SD Card. I have been working with Particle examples in the library previously that have a .INO file and, by and large, they have been successful. I have found that there are many folders do not contain INO files, such as the SDFAT library. In general, how can I use CPP and H files in a new project? I use the INO files as a “go by” Thanks
SDFat
is a user contributed library and as such it’s the contributors choice if and how he adds demos.
And for the demos it’s essentially irrelevant whether it’s a .ino
file or a .cpp
file.
Just click one of the sample files (e.g. TryMeFirst.cpp
) and hit USE THIS EXAMPLE.
It should build and run just the same.
BTW, .ino
files are nothing more or less than .cpp
files which undergo an extra preprocessing pass which will add a #include "Particle.h"
line and create some function prototypes if required.
As said, ignore the file extension. If the file is in the examples
folder you should be able to go by these samples.
Ok, I see. Thanks for the info and it makes sense. The .cpp files are ready to go as published ,can be compiled as is and then sent to the electron on a usb cable… However. what about if I want to modify or use he .cpp code? For example, I’d like to add a DHT22 to the project and save data locally at the particle site. Is there a smart way to use a .cpp to develop such an app?
First, how are you building? What IDE are you using?
Once you used the sample via the USE THIS EXAMPLE button in Web IDE (whether .ino
or .cpp
is irrelevant) it is your project and you can edit it as you wish - adding extra libraries included.
But are you only dry-swimming or actually working on this? If you were actually trying it you’d quickly find the answers to this by just “playing”
You cannot save any data to the "particle site". The Particle Cloud does not store events or data.
I;m sorry, I wasn’t clear I’d like to use a SD card to store the temperature and humidity data I get off a DHT22. Someone could pull a card off the particle and get the historical data in CSV format
So I would use the SDFat data and a recommended DHT22 library to read temp and humidity. I am using the web IDE - V0.4,9.
We are planning to set this up in a friends, (who is a farmer) soy bean farm. We plan on using a set of capacitive soil moisture sensors to monitor soie moisture In the midwest we use rain as irrigation and plan on throttling downs the water leaving the field if we anticipate a dry few days. We are also looking at (eventually) putting in an propeller anemometer to get data that will help us better prediction of water loss in the field as a function of wind, humidity and temperature. We have a working arduino prototype now and are assembling a probe to get moisture at various depths, Since some of the probes may be miles away, we plan on using a electron unit on each probe.
We plan on publishing this as freeware or at least making it freely available. If we make money from it, it will be by assembling, selling and customizing the equipment. Maybe install it if local.
See this video for what they are doing with purchased water farms in the west. Since we cannot throttle the water coming in from the sky, we can only throttle the water leaving the field
https://www.youtube.com/watch?v=V9qbaN86sJs
https://www.youtube.com/watch?v=V9qbaN86sJs
I strongly suggest you move on to 0.6.2 or even 0.7.0-rc.3 which will probably soon be released for official use as default target.
For the DHT22 I am using this library
Thanks for this reply. I am looking to move to 0.6.2 or 0.7.0-rc3. still looking for how to do this, but haven’t given up yet on doing it on my own.
Thanks
With a Photon just build your application against 0.7.0-rc.3 and the system update will be delivered to the device automatically on OTA flash.
Otherwise you can download the binaries and flash them via CLI
Here are my two screen shoots. I am targeting 0.7.0rc prerelease but my device has 0.4.9 on it
Here is my error then.
Appreciate your help. Hope you got the screenshots
Electrons won’t receive an auto-update due to the data cost.
Electrons (unless they are orginization products) need to be updated via USB.
Download the three system part binaries and the bootloader for Electron from the link above and flash via
// in DFU Mode
// first you need to update to an officialy released three part system
particle update
// then you can flash the RC binaries
particle flash --usb <system-parts-in-order>
// in Listening Mode
particle flash --serial <bootloader.bin>
I was able to update to 0.6.2 using this site
https://docs.particle.io/guide/tools-and-features/firmware-manager/core/
I got a feeling I’m on the right path, thanks to you and the help I have gotten._