WiFi-error blocking my program?


I have been playing with my Core a few weeks now but sometimes my Router and Internetconnection give problems in my House… and when that happens my Core stops functioning. It is trying to connect to the Cloud but when that does not succeed my program “freezes up” -is blocked-

I read about switching from automatic to manual connecting to the cloud but the way I see it: even when I connect manually (once every 24 hours?) when there is no internet it still blocks execution of my code (am I right?)

I am planning to use my Core for some “life-depending” situations : controlling temperature and food for my fish, watering my Plants, etc. and it could be dramatic if it stopped working while I am gone for a few weeks.
Yes, I could disconnect it from the cloud but then I would have no means to connect while I am “on the road”…

Did I miss something while exploring this Forum?.. Is there a solution for this?

Many thanks in advance

I’m not sure if this would solve your problem, but if you write your code in a fashion that it doesn’t permanently need the cloud and you only connect/disconnect when needed, then you could try to connect but set up a timed interrupt that may cancel the connection attempt if it doesn’t succeed in due time.

You can find this

When the user calls Spark.connect(), the user code will be blocked, and the Core will attempt to negotiate a connection. This connection will block until either the Core connects to the Cloud or an interrupt is fired that calls Spark.disconnect().

here :wink:

BTW: @Dave, would it not be useful to have something like Spark.connect(uint timeout = 0) which would just terminate any unsuccessful connection attempts without the need for the user to setup a timed interrupt?


I looked at the page about interrupts as you suggested but saw nothing on timed interrupts…
only how to assign an interrupt to a certain pin an how to react to it.
Did I miss something? how can I set up a timed interrupt? (or do I have to make it a Hardware interrupt)

Having a broken internet-connection blocking my program on my Core makes it unreliable (as unreliable as my internet connection or… the servers at Spark - I remember a number of weeks ago there was a serverproblem that blocked my core)… an maybe my Core will come online after the problem is solved… but my fish don’t reboot… :wink:


I’m not aware of any info about how to do timed interrupts in the Spark docs, since it’s more a bare metal thing :wink:

But there is a great library of @peekay123 available on the Web IDE that could help you with that

If you want to learn about the bare metal, this is also a good place to look at :+1:

Maybe your fish need a firmware update, to enable reboot/respawn :wink: Sorry for that :blush:

@FlyingDutchman, take a look here for ideas on using the timer ISR:


1 Like

Hi @FlyingDutchman,

We take our reliability very seriously, please let me know if you’re seeing some kind of issue that you think is on our end, and I’ll investigate. We are constantly improving as we go as well, and sometimes bugs slip through, but we try to keep that a very rare event. :slight_smile:


1 Like