本文整理汇总了C++中SoftwareSerial::readStringUntil方法的典型用法代码示例。如果您正苦于以下问题:C++ SoftwareSerial::readStringUntil方法的具体用法?C++ SoftwareSerial::readStringUntil怎么用?C++ SoftwareSerial::readStringUntil使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SoftwareSerial
的用法示例。
在下文中一共展示了SoftwareSerial::readStringUntil方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkSerialMsg
void GlobalsClass::checkSerialMsg()
{
String msgStr = qCon.readStringUntil('\n');
DebugPrintln("received :" + msgStr);
if ((getValue(msgStr, 0) == "$HMSU")) //msg is good updatemsg
{
if (validatechksum(msgStr) == false) return;
hmSetPoint = getValue(msgStr, 1); if (hmSetPoint == "U") hmSetPoint = "0";
hmPitTemp = getValue(msgStr, 2); if (hmPitTemp == "U") hmPitTemp = "0";
hmFood1 = getValue(msgStr, 3); // if (hmFood1 == "U") hmFood1 = "0";
hmFood2 = getValue(msgStr, 4); // if (hmFood2 == "U") hmFood2 = "0";
hmAmbient = getValue(msgStr, 5); // if (hmAmbient == "U") hmAmbient = "0";
hmFan = getValue(msgStr, 6); // if (hmFan == "U") hmFan = "0";
hmFanMovAvg = getValue(msgStr, 7); //if (hmFanMovAvg == "U") hmFanMovAvg = "0";
hmLidOpenCountdown = getValue(msgStr, 8);// if (hmLidOpenCountdown == "U") hmLidOpenCountdown = "0";
}
else if ((getValue(msgStr, 0) == "$HMAL")) //Alarm is firing....
{
if (validatechksum(msgStr) == false) return;
String AlarmInfo;
bool HasAlarm;
AlarmInfo = "Pit Alarm! : ";
HasAlarm = false;
int msgpos = 1;
for (int i = 0; i < 4; i++) {
String AlarmLo;
String AlarmHi;
AlarmLo = getValue(msgStr, msgpos);
if (AlarmLo.charAt(AlarmLo.length() - 1) == 'L')
{
AlarmLo.remove(AlarmLo.length() - 1, 1);
AlarmInfo += "Probe " + String(i + 1) + " Low: " + AlarmLo + " ! ";
HasAlarm = true;
}
msgpos += 1;
AlarmHi = getValue(msgStr, msgpos);
if (AlarmHi.charAt(AlarmHi.length() - 1) == 'H')
{
AlarmHi.remove(AlarmHi.length() - 1, 1);
AlarmInfo += "Probe " + String(i + 1) + " Hi: " + AlarmHi + " ! ";
HasAlarm = true;
}
msgpos += 1;
} //for each probe, check alarms
//reset alarms
if (ResetTimeCheck > 0) { HasAlarm = false; } //if we're already in alarm countdown, ignore alarm....
if (HasAlarm) {
if (ResetAlarmSeconds > 0) { ResetTimeCheck = millis(); }
else { ResetTimeCheck = 0; } //reset alarm in x Seconds.
MQTTLink.SendAlarm(AlarmInfo);
ThingSpeak.SendAlarm(AlarmInfo);
}
}
}