I don’t think anyone but the Spark team can access your build web IDE from that link, so if you could pop the code into a github or gist, it would be easier for everybody to see.
After talking to @Dilbert, I tried adding a Spark.variable() to the default webduino sample app, and that behaves strangely too. I can get it to work once, but then sometimes it just continues breathing cyan and the web server is non-responsive and the cloud thinks the core is offline.
I am hoping @mdma or @BDub could take a look at this test case (Sorry-I am busy with other projects right now). There are a number of small but persistent problems where using the cloud features somehow knocks other code over in ways that I don’t understand–maybe this is a good one to debug since it is fairly repeatable.
// This #include statement was automatically added by the Spark IDE.
/* This creates an instance of the webserver. By specifying a prefix
* of "", all pages will be at the root of the server. */
#define PREFIX ""
WebServer webserver(PREFIX, 80);
int count = 0; //Spark variable counts accesses
/* commands are functions that get called by the webserver framework
* they can read any posted data from client, and they output to the
* server to send data back to the web browser. */
void helloCmd(WebServer &server, WebServer::ConnectionType type, char *, bool)
/* this line sends the standard "we're all OK" headers back to the
/* if we're handling a GET or POST, we can output our data here.
For a HEAD request, we just stop after outputting headers. */
if (type != WebServer::HEAD)
/* this defines some HTML text in read-only memory aka PROGMEM.
* This is needed to avoid having the string copied to our limited
* amount of RAM. */
P(helloMsg) = "<h1>Hello, World!</h1>";
/* this is a special form of print that outputs from PROGMEM */
pinMode(D7,OUTPUT); //use the LED to indicate a request
Spark.variable("Count", &count, INT);
/* setup our default command that will be run when the user accesses
* the root page on the server */
/* run the same command if you try to load /index.html, a common
* default page name */
/* start the webserver */
int len = 64;
/* process incoming connections one at a time forever */