本文整理汇总了C++中StringArray::GetElementCount方法的典型用法代码示例。如果您正苦于以下问题:C++ StringArray::GetElementCount方法的具体用法?C++ StringArray::GetElementCount怎么用?C++ StringArray::GetElementCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringArray
的用法示例。
在下文中一共展示了StringArray::GetElementCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleReadCommand
void handleReadCommand(StringArray commandList)
{
DebugPrint("Function handleReadCommand");
String temp = "";
if (commandList.GetElementCount() > 1)
temp = commandList.GetString(1);
else
temp = "0";
int test = GetIntFromString(temp);
byte data = EEPROM.read(test);
String outputstring = commandList.GetString(1) + ": [" + commandList.GetString(1) + "]: " + String(data,HEX) + "\0";
PrintMessage(outputstring);
}
示例2: handleSerialCommands
void handleSerialCommands()
{
DebugPrint("Function handleSerialCommands");
StringArray commandList = GetCommandList(INPUT_STRING);
String command = commandList.GetString(0);
DebugPrint("Command was: " + command);
// RobotControl
// Switch Robot On
if (command == "ON")
{
GLOBAL_IS_CONNECTED = true;
digitalWrite(13,HIGH);
Servos_Init();
PrintMessage(command);
}
// Switch Robot Off
else if (command == "OFF")
{
GLOBAL_IS_CONNECTED = false;
PrintMessage("OFF");
digitalWrite(13,LOW);
Servos_Release();
}
// EEPROM Handling
// Store Movement List
else if (command == "STORE")
{
SaveToEEPROM();
}
// Retrieve Movement List
else if (command == "GET")
{
// PrintMessage("get");
LoadFromEEPROM();
}
// Erase Movement List
else if (command == "ERASE")
{
ClearEEPROM();
}
// READ Specified EEPROM Address
else if (command == "READ")
{
handleReadCommand(commandList);
}
// Servohandling
// Move Servo
else if (command == "MOVE")
{
Move_Servo(commandList);
/*
int oldValue = servo.read();
int newValue = GetIntFromString(commandList.GetString(1));
if (oldValue <= newValue)
{
for (int i = oldValue; i <= newValue; i++)
{
servo.write(i);
delay(10 * (5 - GLOBAL_SERVO_SPEED));
}
}
else
{
for (int i = oldValue; i >= newValue; i--)
{
servo.write(i);
delay(10 * (5 - GLOBAL_SERVO_SPEED));
}
}
*/
/*
if (commandList.GetElementCount() >= 4)
Move_Servo(commandList);
else
PrintMessage("Error: not enough Arguments, Example MOVE;SERVONUMBER;SPEED;VALUE");
*/
}
// Set Speed
else if (command == "SPEED")
{
int newSpeed = GetIntFromString(commandList.GetString(1));
if (newSpeed >= 0 && newSpeed <= 5)
{
DebugPrint("GLOBAL_SERVO_SPEED set to: " + String(newSpeed));
GLOBAL_SERVO_SPEED = newSpeed;
SaveSpeed(newSpeed);
}
PrintMessage("Speed set to: " + String(GLOBAL_SERVO_SPEED));
}
else if (command == "SPEED?")
{
PrintMessage(String(GLOBAL_SERVO_SPEED));
}
// Play LISTPOS #position
else if (command == "LISTPOS")
{
int numberPositions = commandList.GetElementCount();
//.........这里部分代码省略.........