Spark Code Stops Running

I’m sorry but I have two separate questions/issues, so I will post them separately. If I’m doing something wrong, please inform me. I have code that essentially just turns on the built in LED, changes a value, waits, turns it off, changes the value again, waits, and then loops. First of all, I can’t get a value during a delay. Is this normal? (Using the REST API calls) Second, while the code is running, every 3 loops the Spark goes through a cycle of blinking lights and then returns. After that deal for a while, every few loops it’ll blink the red led twice and then blink normally twice and then return to the code. And then after that, the light just pulses its usual blue greenish color, no longer blinking the light (my indication it isn’t running the code?) and calls to get the variable simply result in 536891392.

P.S. Quick bug. If there is an error in the code, the flash will act like its working but just not update the core. If I run the check code, I can find the problem, and then flash it.

Now on to the second thread.