Particle CLI with local libraries

I’m really stuck!

I’m using Particle CLI 3.45.1 on macOS.

I’m trying to locally compile an app (.ino) locally with CLI using a local library and old DeviceOS.

Specifically, Blynk 1.1.0 and Device OS 1.2.1 for a Photon.

This was originally built in January 2023 when Blynk updated their service. Well, an inadequate diode (my mistake), and my Photon has died. I have a replacement Photon, so I just want to recompile, reflash, and go. Well, that doesn’t work with the Web IDE, since it tries to load the latest Blynk library and Device OS.

I have my Device OS flashed to 1.2.1. But, the web IDE updated my library Blynk version to 1.3.2, which, for some reason, puts the Photon into a panic (flashing magenta) shortly after startup.

I have a local folder with project.ino and a project.properties file that has only one dependency:

dependencies.blynk=1.1.0

I saw where Particle CLI stores libraries, so I downloaded the older Blynk library from GitHub and installed it in a parallel path, taking care of the filename and library.properties file.

I also made sure I had blynk.h set to use the right board include file:

#include "BlynkSimpleParticle.h"

I am using the following command in the local folder

particle compile photon project.ino --target 1.2.1 --saveTo firmware.bin

Particle CLI just can’t seem to find blynk.h! Here’s the relevant barf from CLI:

aquarium1-photon-4.ino:7:19: fatal error: blynk.h: No such file or directory
compilation terminated.
../build/module.mk:277: recipe for target '../build/target/user/platform-6-maquarium1-photon-4.o' failed
make[2]: *** [../build/target/user/platform-6-maquarium1-photon-4.o] Error 1
make[2]: Leaving directory '/firmware/user'

[I referred to my application as project.ino, but the true filename is aquarium1-photon-4.ino]

How can I force a local compile, and, use a specific local library?

This is easier to do with Workbench, but will work with the CLI.

  • Create a project directory with a project.properties file at the top level
  • A src directory containing your .ino file
  • A lib directory containing the versions of the libraries that you want to use
  • Make sure the library is not listed in project.properties!

See Workbench pseudo libraries which also applies to Workbench using the cloud compilers, or using the Particle CLI directly.

Rick!!! I’m an hobby user, only have a handful of devices, and have been gone from the community for a long time. That said, I saw a quick reply, and, was delighted to see it was the familiar person who is all over this forum, for many years - thank you!

…well, I may have missed a step. I emptied my project.properties file, and moved things as you suggested. Same error. I also tried removing the “@1.1.0” suffix and that didn’t work.

I also tried editing my source file (.ino) and going from <blynk.h> to “blynk.h”, no luck.

I do really have a blynk.h file! (the original file from Blynk I renamed, then, made a copy and made sure it pointed to a Particle header)

Contents of blynk.h:

#incude "BlynkSimpleParticle.h"

…very strange that this happens. I must be overlooking something simple.

Sorry, I missed something initially.

Change this:

particle compile photon project.ino --target 1.2.1 --saveTo firmware.bin

To this, and run the command in the photon directory containing project.properties.

particle compile photon . --target 1.2.1 --saveTo firmware.bin

If you specify the ino filename, it only builds the ino file, not the rest of the project. The dot builds the whole directory, including src and lib.

BAM! That was it! THANK YOU!

It’s so cool when it works! I really love these little devices. I should do more with them, for sure!

2 Likes