Initial commit

This commit is contained in:
Siwat Sirichai 2020-11-17 01:47:02 +07:00
commit c437610853
7 changed files with 149 additions and 0 deletions

25
pyArduinoYun/src/main.cpp Normal file
View file

@ -0,0 +1,25 @@
#include <Arduino.h>
#include <ArduinoJson.h>
#include <Bridge.h>
void setup() {
// put your setup code here, to run once:
Serial1.begin(115200);
Bridge.begin();
}
void loop() {
// put your main code here, to run repeatedly:
if (Serial1.available()) {
String json = Serial1.readStringUntil('|');
StaticJsonDocument<200> doc;
DeserializationError error = deserializeJson(doc, json);
if (error) {
Serial1.print(F("deserializeJson() failed: "));
Serial1.println(error.f_str());
return;
}
String mode = doc["mode"];
Serial1.println(mode);
}
}