Hi
Here small explanation to add Something in Pfod :
For example in rain menu:
As you can see 2 parts:
sendRainMenu
is call to print the data, 1000 is the refresh rate.
The first digit on "m00" descibe the menu itself (rain here) the 2 others digit are use to reference the text,SendYesNo or slider you print and is different on each new object
rocessRainMenu
is call when you change Something with the phone
If you click on Rain Use : if (pfodCmd == "m00") is call and the variable robot->rainUse is switch from Yes to No or opposite.
m01 is only print value so if you click on raincounter nothing is call in processRainMenu.
m06 is a slider so sendSlider("m06", F("Maximum Temperature"), robot->maxTemperature, "", 1 ,80, 1); is used to print it
F("Maximum Temperature") is the text you see on your phone.
robot->maxTemperature is the value of the slider.
1 ,80, 1 are minimum,maximum and step (i don't remember the exact order and maybe strange between Pfod and Arduremote on negative value ??).
When you click on the slider:
else if (pfodCmd.startsWith("m06")) processSlider(pfodCmd, robot->maxTemperature, 1);
is call and the robot maxTemperature is change.
So to add a slider
First use Ctrl F on ide to be sure the "m07" is not use.
Into sendRainMenu add
and into processRainMenu
To add simple text follow by a value
Into sendRainMenu add:
To add a yes/No button
Into sendRainMenu add:
and into processRainMenu add:
Hope it can help !
Here small explanation to add Something in Pfod :
For example in rain menu:
Code:
void RemoteControl::sendRainMenu(boolean update) {
if (update) serialPort->print("{:"); else serialPort->print(F("{.Rain`1000"));
serialPort->print(F("|m00~Rain Use "));
sendYesNo(robot->rainUse);
serialPort->print(F("|m01~Counter "));
serialPort->print(robot->rainCounter);
serialPort->println(F("|m02~Value"));
serialPort->print(robot->rain);
serialPort->println(F("|m03~DHT22 Use "));
sendYesNo(robot->DHT22Use);
serialPort->println(F("|m04~Temperature "));
serialPort->print(robot->temperatureDht);
serialPort->println(F("|m05~Humidity "));
serialPort->print(robot->humidityDht);
sendSlider("m06", F("Maximum Temperature"), robot->maxTemperature, "", 1 ,80, 1);
serialPort->println("}");
}
void RemoteControl::processRainMenu(String pfodCmd) {
if (pfodCmd == "m00") robot->rainUse = !robot->rainUse;
else if (pfodCmd == "m03") robot->DHT22Use = !robot->DHT22Use;
else if (pfodCmd.startsWith("m06")) processSlider(pfodCmd, robot->maxTemperature, 1);
sendRainMenu(true);
}
As you can see 2 parts:
sendRainMenu
is call to print the data, 1000 is the refresh rate.
The first digit on "m00" descibe the menu itself (rain here) the 2 others digit are use to reference the text,SendYesNo or slider you print and is different on each new object
rocessRainMenu
is call when you change Something with the phone
If you click on Rain Use : if (pfodCmd == "m00") is call and the variable robot->rainUse is switch from Yes to No or opposite.
m01 is only print value so if you click on raincounter nothing is call in processRainMenu.
m06 is a slider so sendSlider("m06", F("Maximum Temperature"), robot->maxTemperature, "", 1 ,80, 1); is used to print it
F("Maximum Temperature") is the text you see on your phone.
robot->maxTemperature is the value of the slider.
1 ,80, 1 are minimum,maximum and step (i don't remember the exact order and maybe strange between Pfod and Arduremote on negative value ??).
When you click on the slider:
else if (pfodCmd.startsWith("m06")) processSlider(pfodCmd, robot->maxTemperature, 1);
is call and the robot maxTemperature is change.
So to add a slider
First use Ctrl F on ide to be sure the "m07" is not use.
Into sendRainMenu add
Code:
sendSlider("m07", F("New slider"), robot->oneRobotExistingVar, "", 1 ,255, 1);
Code:
else if (pfodCmd.startsWith("m07")) processSlider(pfodCmd, robot->sameRobotExistingVar, 1);
To add simple text follow by a value
Into sendRainMenu add:
Code:
serialPort->println(F("|m08~My Text "));
serialPort->print(robot->oneRobotExistingVar);
To add a yes/No button
Into sendRainMenu add:
Code:
serialPort->print(F("|m09~Toggle button "));
sendYesNo(robot->oneRobotExistingVar);
Code:
else if (pfodCmd == "m09") robot->oneRobotExistingVar = !robot->oneRobotExistingVar;
Hope it can help !