Hi all,with a bit of time on my hands I would like to get to grips with the CLI and I was wondering what the “best way” to use it was?
Basic/simple questions follow,
do you / does one make a directory in the root say “C:\particletemp” and then put in the folders containing the library / s and code ?
Is there a list of MUST not doo’s, like don’t add two .ino files?Or don’t have a folder in there just have everything in one directory?
If you particle flash, does that compile the directory as well?
Or should you particle compile first?
I assume you particle compile to get a .bin file and then particle flash that to the device?
if you particle flash XXXXXXXXXXX C:\test.ino What is the best /most convenient way to recall your ID number?
If your photon is attached via usb does it flash that one by default?
Thank you very much.
To start, things will get easier soon - especially in regards to use of libraries.
But for now, you can have a dedicated directory that contains your projects and libraries, but to use libraries in a project they need to be “present” inside your project folder. Although that doesn’t need to by physical but can be achieved via links.
On Windows it’s fine to have the libraries inside folders, but the includes should be written as if the project folder was flat (no subdirs).
The bit about only one
.ino file in your project folder is true and especially applies to the library examples and even holds true for
.cpp files, since the point is not the file extension, but the demand to have only one set of
loop() in the whole project tree.
I’d always compile first - although that’s no must.
You can also use the device name - not only the ID - to OTA flash your device.
If you want to flash via USB, you’d use
particle flash --usb firmware.bin (DFU Mode) or
particle flash --serial firmware.bin (Listening Mode).
Thank you very much @ScruffR. I will study.I am sure more questions will come. I am looking forward to the new library set - up. Can you say what and when that will happen?