pfodSMS SIM900
pfodSMS SIM900
new 1
if ('.' == cmd) {
// pfodApp has connected and sent {.} , it is asking for the main menu
// send back the menu designed
sendMainMenu();
// now handle commands returned from button/sliders
} else if('A'==cmd) { // user moved slider -- 'Pin D3 is '
// set output based on slider 0 == LOW, 1 == HIGH
parser.parseLong(pfodFirstArg,&pfodLongRtn); // parse first arg as a long
digitalWrite(cmd_A_pin,pfodLongRtn); // set output
sendMainMenuUpdate(); // always send back a pfod msg otherwise pfodApp will disconnect.
} else if ('!' == cmd) {
// CloseConnection command
closeConnection(parser.getPfodAppStream());
} else {
// unknown command
parser.print(F("{}")); // always send back a pfod msg otherwise pfodApp will disconnect.
}
}
//
<<<<<<<<<<<
}
void closeConnection(Stream *io) {
// nothing special here for SMS
}
void sendMainMenu() {
parser.print(F("{.")); // start a Menu screen pfod message
send_menuContents(); // send the menu contents
parser.print(F("}")); // close pfod message
}
void sendMainMenuUpdate() {
parser.print(F("{:")); // start an Update Menu pfod message
send_menuContents(); // send the menu contents
parser.print(F("}")); // close pfod message
}
// modify this method if you need to update the menu to reflect state changes
void send_menuContents() {
// send menu prompt
parser.print(F("<w><+5><b>Using GPRS shield to turn D3 on and off via SMS"));
// send menu items
parser.print(F("|A~<+4><b>Pin D3 is\n`"));
parser.print(digitalRead(cmd_A_pin)); // read current output state 0 Low or 1 High
parser.print(F("~~Low\\High")); // Note the \\ inside the "'s to send \
// ============ end of menu item ===========
}
// ============= end generated code =========
-2-