Moving from imp002 to imp003


#1

I’m finally beginning some work on the migrating my code from the imp002 to imp003. I note that the page: https://electricimp.com/docs/api/imp/environment/
shows an example at the top of the page that probably won’t work as intended.

If I test for “pinA” in hardware first, both the imp2 and imp3 will satisfy it. The example should test for “pinY” before “pinA”


#2

True, though the other example a bit further down the page gets it right.

In retrospect, imp.environment was a silly idea – in future we’ll probably supply a standard Squirrel library that returns the imp type (which itself will be implemented in terms of the “if foo in hardware” method).

You can check for “pinXA” to detect imp005.

Peter