How to handle Imp powering on

I’m using http.onrequest agent to take in a POST from a website and then it sends value to imp so the imp can send that value to my RS232 device (UART). I am using a MAX232 chip. It works great until I shut off the imp and turn it back on … emulating a power loss and the power coming back on. When it comes back on, it seems to be lost or stuck … always writing to UART. Is there a way to do a single function call when the power returns?

Another thing … when it powers on and it’s lost, when I go to my webpage and POST a value, everything gets back on track.

So my question is about handling a powering up condition without needing to POST a value from my PHP script.

When the imp powers up, it just runs your squirrel from the start. Can you describe a bit more what happens? Sounds like the code is initializing something in the path where new data is received from the agent.

btw, you should also be using a MAX3232. The MAX232 is a 5v part and doesn’t work reliably at 3.3v (learnt this the hard way!)

Yes, it is the MAX3232 (I typed it wrong). I’ll try a few more things with my code before I say for sure what is happening. The RS232 communication is working really good though (for those interested in that part). You might have given me something to look at pertaining to code initializing. thanks.

BTW, I’m communicating with a 1984 Tandy Model 200 Computer. 1984 technology married with 2013 technology.

Sweet! I used to have an Exididy sorcerer which was sort-of a model 100 clone…

:slight_smile: My first computer was a TRS-80, followed by a Tandy 1000 TL-2.