Creating soft http pages

Bare with me I am a newbie.

I reviewed the following documenation: https://docs.particle.io/reference/firmware/photon/#softap-http-pages.

And when I try to verify the code I get that the following libraries are not inlcuded. Where can I find the below files?

#pragma SPARK_NO_PREPROCESSOR
#include "Particle.h"
#include "softap_http.h

These are part of the Particle framework, so you won’t need to import the “libraries”, the includes should suffice.

To get proper answers you’d need to state what IDE you’re using, what device you are targeting and what system version.
Also when you get errors posting the error messages saves us the need to guess :wink:
And if you have own code, make sure to add that too.

2 Likes

Thank you @ScruffR for the reply.

I am having a couple of issues.

First issue is that I need to be able to compile and create a firmware binary. The file I get after clicking that button in Particle IDE, does not upload in the Dashboard (dashboard.particle.io) to deploy to multiple Photons under the product area. I get an error message, stating it is not a binary file.

I am attempting to run a pilot on three hardware devices. Because the export of the binary file does not work, I am attempting to get all the include files and create firmware. For example below is the error if I use another compiler like Arduino IDE:

Arduino: 1.6.8 (Mac OS X), Board: "Arduino/Genuino Uno"

In file included from /Users/Farah/sketch_aug11a/sketch_aug11a.ino:2:0:
sketch/RelayShield/RelayShield.h:1:25: fatal error: application.h: No such file or directory
 #include "application.h"
                         ^
compilation terminated.
exit status 1
Error compiling for board Arduino/Genuino Uno.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

When compliled/verified in the Particle IDE I get the following errors:

In file included from firstapp.cpp:2:0:
RelayShield/RelayShield.h:26:8: warning: extra tokens at end of #endif directive [enabled by default]
 #endif RelayShield_h
        ^
firstapp.cpp:5:0: warning: ignoring #pragma SPARK_NO_PREPROCESSOR  [-Wunknown-pragmas]
 #pragma SPARK_NO_PREPROCESSOR
 ^
firstapp.cpp: In function 'void loop()':
firstapp.cpp:125:19: error: 'chargeBattery' was not declared in this scope
     chargeBattery();
                   ^

make[1]: *** [../build/target/user/platform-6firstapp.o] Error 1
make: *** [user] Error 2
Error: Could not compile. Please review your code.

While the Particle IDE just warns me about the include files, it still means nothing because when I tried to upload the binary I get an error that it is not a valid file and that is it. So I must try to collect all the files and learn how to create a binary by another means.

When I search the library in the Particle IDE they do not come up. For example, within the same code, I use the Particle Relay code. And for that to work, I had to include them from the library. So I do not understand why I wouldn’t have to include the folders for the softap HTTP.

I found the following on GitHub - is it trustworthy? https://github.com/OpenFOAM/OpenFOAM-2.2.x/blob/master/src/lagrangian/basic/particle/particle.H

The code I ran before including softap worked perfectly fine no errors.

However, I do see that my function void loop has an issue. But that issue did not exist until I added the softap code. To debug why this would be happening I pasted in one line of code at at time (my original code and the softap code). And when I got to the void loop errors starting appearing. My softap code is before the void loop.

So even if I fix the void loop error, I still cannot get a binary to do a firmware update across multiple devices in my Dashboard (dashboard.particle.io), so I need the include files to determine what is going on.

Have you ever used the “Compile and download firmware binary.” button in Particle IDE? It doesn’t work for me, even with the code compiles and is uploaded to the Photon.

All three Photons are on 0.5.2. I am using a Mac if that matters.

Note: I am hesitant to post all of my code as I am trying to use it for a product. However, I am not having much success so I am not confident in using this in a consumer product.

Thank you in advance for any insight.

First you can't build Particle binaries with the Arduino compilers, since Arduino IDE has no knowledge of the Particle framework.

Next, I can see an error message

Which will inevitably mean you will not get a valid binary.
Correct that first. only aftet that we can move on to your other questions.

But if you want to build a binary you can upload to the Console, you need to add use the PRODUCT_ID() and PRODUCT_VERSION() macros to mark this binary compatible to your product.

And finally I have to repeat what I already said

We have some :crystal_ball: foo, but not enough to guess how your code exactly looks.
You can PM your code so noone but me would see it.

The download button in Build does work just fine, when you build a compatible firmware.

You can also use CLI for building

particle compile photon <projectDirectory> --saveTo firmware.bin

And in order to use libraries, go to the lib in Build and click the GitHub icon to find the library sources, download them, place the contents of the firmware folder in your project directoy, correct add flattened #include statements and you should be good.

Hi @ScruffR, thanks again for replying. I have tried all you have mentioned, with exception to trying CLI for building. I sent you a private message with my code. Hopefully, you can spot what is wrong.