平台提供的开关灯代码,

作者:Blue moon | 更新时间:2019-04-12 | 浏览量:1023

//处理网络接收到到指令,执行相关动作
void processMessage(aJsonObject *msg) {
  aJsonObject* method = aJson.getObjectItem(msg, "M");
  if (!method) {
    return;
  }
  String M = method->valuestring;
  if (M == "WELCOME TO BIGIOT") {
    checkOut();
    checkoutTime = millis();
    return;
  }
  if (M == "connected") {
    checkIn();
  }
  if (M == "say") {
    aJsonObject* content = aJson.getObjectItem(msg, "C");
    aJsonObject* client_id = aJson.getObjectItem(msg, "ID");
    String C = content->valuestring;
    String F_C_ID = client_id->valuestring;
    if (C == "play") {
      digitalWrite(LED, HIGH);
      say(F_C_ID, "LED on!");
    }
    if (C == "stop") {
      digitalWrite(LED, LOW);
      say(F_C_ID, "LED off!");
    }
  }

 

哪位大佬帮看下这部分的代码是什么意思啊?


评论:共0条

返回顶部