本文整理汇总了C++中SerialCommand::addCommand方法的典型用法代码示例。如果您正苦于以下问题:C++ SerialCommand::addCommand方法的具体用法?C++ SerialCommand::addCommand怎么用?C++ SerialCommand::addCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SerialCommand
的用法示例。
在下文中一共展示了SerialCommand::addCommand方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setup
void setup() {
Serial.begin(115200);
pinMode(DRIVE_PIN1, OUTPUT);
pinMode(DRIVE_PIN2, OUTPUT);
pinMode(DRIVE_ENABLE_PIN, OUTPUT);
myservo.attach(STEER_SERVO);
myservo.write(DEFAULT_STEER);
Serial.println("Ready");
sCmd.addCommand("T", throttle);
sCmd.addCommand("S", steer);
sCmd.addCommand("R", reset);
sCmd.addCommand("@", ping);
sCmd.addCommand("V", voltage);
sCmd.addCommand("D", distance);
sCmd.addDefaultHandler(unrecognized);
}
示例2: setup
void setup()
{
// initialize the serial communication:
serial.init(TTYACM0, 115200, openComport);
serial.setPacketHandler(handlePacket);
sCmd.addCommand(1, respondData);
gettimeofday(&start, NULL);
gettimeofday(&startLoop, NULL);
uiRxPacketCtr=0;
uiTxPacketCtr=0;
}
示例3: setup
void CommandSet::setup()
{
/* Setup callbacks for SerialCommand commands */
sCmd.addCommand("L", this->led); // Toggles LED
sCmd.addCommand("ping", this->ping); // Check serial link
sCmd.addCommand("help", this->help);
/* Movement commands */
sCmd.addCommand("M", this->move); // Runs wheel motors
sCmd.addCommand("S", this->stop); // Force stops all motors
sCmd.addCommand("G", this->go); // Runs wheel motors with correction
/* Read from rotary encoders */
sCmd.addCommand("speeds", this->speeds);
/* Misc commands */
sCmd.addCommand("pixels", this->pixels); // Set LED colour
sCmd.addCommand("grab", this->grab); // Grab 0 or 1
sCmd.addCommand("kick", this->kick); // Kick
sCmd.addCommand("shuntkick", this->shuntkick); // Shuntkick
sCmd.addCommand("rotate", this->rotate); // Rotate
/* Debug and inspection commands */
sCmd.addCommand("ps", this->proc_dump); // Show process status
sCmd.addCommand("ptog", this->proc_toggle); // Enable or disable by pid on the fly
sCmd.setDefaultHandler(this->unrecognized); // Handler for command that isn't matched
}
示例4: addCommand
void addCommand(const char *cmd, void(*function)(), const char *wildcard)
{
sCmd.addCommand(cmd, function);
}