 
   /*
     DI連続転送ON
-    format   => stream/di/on/{port}
-    {port} => 連続転送を有効にするポート番号
-    example  => stream/di/on/1
-
-     streamのレスポンス
-
-     streamのレスポンスはeventとして定義する
-
-     {"event":"di", "datas":[
-        {"msg":"OK","port":[port],"val":[val]},
-        {"msg":"OK","port":[port],"val":[val]},
-        ...
-        {"msg":"OK","port":[port],"val":[val]}
-     ]}
+    format  => stream/di/on/{port}?interval={msec}
+    {port}  => 連続転送を有効にするポート番号
+    {msec}  => DIポート読み取り間隔(ミリ秒)
+    example => stream/di/on/1?interval=1000
+
+
    */
   {"stream/di/on/", &streamDiOnTask},
 

  }

  uint8_t port = strToInt(query);
  bitClear(di_stream_enable_ports, port);

  return okIoJson(port, 0);
}

String streamAiOnTask(String query){

  String error = checkPortQuery(query);
  if(error){
    return error;
  }

  uint8_t port = strToInt(query);
  bitSet(ai_stream_enable_ports, port);

  return okIoJson(port, 1);
}

String streamAiOffTask(String query){

  if(query == "all"){
    ai_stream_enable_ports = 0;
    return okIoJson(0xff, 0);
  }

  String error = checkPortQuery(query);
  if(error){
    return error;
  }

  uint8_t port = strToInt(query);
  bitClear(ai_stream_enable_ports, port);

  return okIoJson(port, 0);
}


  Serial.begin(115200);
  Serial.println("READY");
  pinMode(13, OUTPUT);
  timer2Start();
}

void loop() {
