Closed LAN not working

Hi,

I have a spark core and when I currently have read data from the spark core using telnet. It works fine as long as the router is connected to the internet. When I switch to a closed LAN router. I can ping the device but I can’t telnet to it. Another strange thing is the led will blink Cyan then go to green.

Any help will be appreciated.

Thanks,
David

So you’re right. In closed LAN, there is no internet and the user code will not run.

There’s a discussion going on to see if we should make it default to have the code running without internet and it should be that way.

If you want to use in the closed environment, you can add some code to skip connecting to the internet and continue running your code. Will that be good?

I can find the code and paste here if needed.

Just take note that you won’t be able to update firmware over the internet unless maybe you put a command in serial to trigger the connection to the internet :smiley:

Kenneth,

Thank you, if you could find me the code would be great.

Thanks,
David

This is an area where the Spark team is actively spec’ing out and working on way to make this easy.

Right now, you need to start with cloud off and then turn the cloud on when you need it. But you need to manage it very closely. This will be much easier when the Spark team is done.

#include spark_cloud_disable.h
...
//lots more more code here
...
Spark.connect();

while (!Spark.Connected) {  //wait for connection
  SPARK_WLAN_Loop();
}
//do something
// wait for it to be done
Spark.diconnect();

Note that all these includes and functions are likely to change in the future, so the Spark team has not doc’ed this. All the examples are just here in the forum.

Also note that in order to flash your core over-the-air, you need to be connected to the Spark cloud. There is a thread about that here.

I have never tried doing it but some others have so they can input more later.

The full example code is here: https://github.com/spark/core-firmware/commit/f437dc4756671b08150fefdeb9c7471b9dc581ca#diff-dc163d478829a168052558d3caa355e1L685

In short, you need to add the following before setup():

 #include "spark_disable_cloud.h"

Has this been further developed?
I am interested in reading data from a core only via a webpage on the local network. The data connection needs to be quite fast.

Its not well documented in the help files but its all working well

there is options for both wifi and cloud connections. if you just want to have wifi and not the cloud you can use the line kennethlimcp suggests above. to disable wifi too you can add

#include "spark_disable_wlan.h"

this lets the user code start before attempting to connect to the wifi, and the best bit is it can still be turned back on!
These are the commands:

WiFi.on();
WiFi.off();
Spark.connect();
Spark.disconnect();