# \[SOLVED\] Offline Function

**URL:** <https://community.particle.io/t/solved-offline-function/40539>\
**Category:** Raspberry Pi\
**Created:** [March 23, 2018, 9:55am UTC](https://community.particle.io/t/solved-offline-function/40539 "2018-03-23T09:55:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pierreantoine](https://avatars.discourse-cdn.com/v4/letter/p/e9bcb4/32.png) [@pierreantoine](https://community.particle.io/u/pierreantoine)\
**Post date:** [March 23, 2018, 9:55am UTC](https://community.particle.io/t/solved-offline-function/40539/1 "2018-03-23T09:55:30Z")

</div>

Hello,

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

---

<div class="post-metadata">

**Author:** ![Moors7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/moors7/32/588_2.png) [@Moors7](https://community.particle.io/u/Moors7)\
**Post date:** [March 23, 2018, 10:42am UTC](https://community.particle.io/t/solved-offline-function/40539/2 "2018-03-23T10:42:18Z")

</div>

Have a look 🙂

[https://docs.particle.io/reference/firmware/raspberry-pi/#digitalread-](https://docs.particle.io/reference/firmware/raspberry-pi/#digitalread-)

---

<div class="post-metadata">

**Author:** ![pierreantoine](https://avatars.discourse-cdn.com/v4/letter/p/e9bcb4/32.png) [@pierreantoine](https://community.particle.io/u/pierreantoine)\
**Post date:** [March 23, 2018, 11:38am UTC](https://community.particle.io/t/solved-offline-function/40539/3 "2018-03-23T11:38:22Z")

</div>

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 '-\_-

---

<div class="post-metadata">

**Author:** ![Moors7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/moors7/32/588_2.png) [@Moors7](https://community.particle.io/u/Moors7)\
**Post date:** [March 23, 2018, 11:41am UTC](https://community.particle.io/t/solved-offline-function/40539/4 "2018-03-23T11:41:51Z")

</div>

In pseudo-code:

```auto
int Pin = D0;

void loop(){
  if (digitalRead(Pin) == HIGH){
    doFunction();
  }
}

```

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

> [@pierreantoine](#):
>
> But is there a way to call this particle function from the physical button (connected to Raspi by a pin), and even without wifi ?

That's exactly what the docs example shows you to do 😉

---

<div class="post-metadata">

**Author:** ![pierreantoine](https://avatars.discourse-cdn.com/v4/letter/p/e9bcb4/32.png) [@pierreantoine](https://community.particle.io/u/pierreantoine)\
**Post date:** [March 23, 2018, 12:54pm UTC](https://community.particle.io/t/solved-offline-function/40539/5 "2018-03-23T12:54:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pierreantoine](https://avatars.discourse-cdn.com/v4/letter/p/e9bcb4/32.png) [@pierreantoine](https://community.particle.io/u/pierreantoine)\
**Post date:** [April 30, 2018, 12:19pm UTC](https://community.particle.io/t/solved-offline-function/40539/6 "2018-04-30T12:19:43Z")

</div>

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.
