Code Testing without IMP

I am currently working half from home with my own wireless setup and at work, where I am slave to the IT team’s speed of adding IMPs to the network. Which means I can’t prototype at work currently.
But I could code from here. One thing would be to leave the IMP at home, connected, but here is another one:

What if I could code test without IMP connected? Could I run the code and especially for off-server requests, etc. I could use the log for debugging and then when everything is working, I could just connect the IMP and ‘TADA!’. I think I am talking something between a device simulator(like in Xcode) and a code that runs without device.

Is that easily possible?

You can download, compile, and run a squirrel environment from http://www.squirrel-lang.org/.

The imp has a few differences from standard squirrel and obviously the squirrel language doesn’t have any of the classes listed on the devwiki (imp, hardware, pin, i2c, spi, etc). It’s possible to make stub code so that your code won’t crash but its not easy to emulate all the functionality of the imp in native squirrel - you would need to dive into C code for that (imp.wakeup is a good example). Also, you’re not going to be able to connect to the imp cloud so you won’t be able to test any of that code.

Here’s an example on how to make your stub code:
imp <- {} imp.configure <- function(name, in, out, config = {}, callback = null){ //Emulation code to return something that the function would goes here }

Now if Hugo and team want to release a compiled version of the squirrel that runs on the imp - that could change the ball game quite a bit! =)

What’s the disadvantage of leaving the Imp home connected?
Of course you can’t change the external hardware.
But there’s little danger of it crashing!

Not saying there is a disadvantage, rather only thing is that currently, I cant test the IMP at work.

But you can write and run code at work!

I can, yet as you can see on some of my other posts, the IMP seems to freeze or stop communicating occasionally, which requires a manual restart hardware style where the IMP is, which then is not where I am.

@uncleunvoid the other thing would be to use a second imp to cycle the power to the first imp by remote control… :slight_smile:

Great idea Hugo! As you can see by my posts today, it goes offline for many different reasons. All of them user error? You just have to be careful when coding remotely.

Or use an Arduino to cycle the power every hour. Only do it when it’s sleeping or offline? That takes about a minute to setup with a MOSFET. No extra parts needed.

The IMP s been running better.
I am currently trying to get arduino and IMP to talk (see my other posts).
Next step after that, energy management.