[SOLVED] Offline Function


Sorry if I’m being noob here but I’m new on iOT technologies.
I’m working on Particle with a RaspPi B (Raspbian up to date), and I need to create several online + offline functions.

Let’s take a simple example : I need to switch on and off a LED from an App AND from a physical button, but I also need this button to work offline :

  • I created a function on particle, which is working through particle console,
  • I can call this function through the mobile app using the API, everything fine,
  • But is there a way to call this particle function from the physical button (connected to Raspi by a pin), and even without wifi ?

Otherwise I can probably redevelop a function with Python or C specifically for the Raspi + button, but that means 2 parallel developments and losing the practicality of Arduino language.

Maybe Particle CLI on Linux could be the solution ? Not sure about offline possibility with it, but for know I didn’t achieve to install it (there is a bug I need to figure out).

Thank you very much for your help, hopefully this is just a simple thing to achieve :o

Have a look :slight_smile:



Thanks, but I’m sorry I don’t really get it.
digitalread will allow me to understand the state of the light if the button have been used offline I guess.

Bu my question is more about what is there a simple way to call and use a particle function offline on raspberry (so I develop most of my product functionalities on particle IDE). Not sure if I’m clear here '-_-

In pseudo-code:

int Pin = D0;

void loop(){
  if (digitalRead(Pin) == HIGH){

Check the status of your button pin, and act accordingly.

That’s exactly what the docs example shows you to do :wink:

1 Like

Ok great thank you !
I will try this asap and let you know :slight_smile:

Just a quick update : Everything works fine offline.
I just didn’t get that every programs developed on Particle IDE and flashed on Raspberry don’t need an online connection to work, they are flashed “locally”.

Thank you for your help on this.

1 Like