I found that the above posted code will both turn the shield or off, depending on the current condition of the shield.
The problem could come into play that you reset a already powered up and running arduino, and the powerup code, presumably in your setup routine, would execute again and turn off the shield.
I noticed with my V2.0 shield, that a much longer physical button press is required to turn the shield off than to turn it on.
I tinkered with the code, and I am now using this timing, which will turn the shield on, but will not turn it off if it is already on.
I suppose one could use AT commands to detect the current power-state of the SIM900, but this was easier for me.
- Code: Select all
Serial.println("Powering Up SIM900");
Serial.println("SIM900 Powered Up");