Initial commit
This commit is contained in:
commit
c437610853
7 changed files with 149 additions and 0 deletions
25
pyArduinoYun/src/main.cpp
Normal file
25
pyArduinoYun/src/main.cpp
Normal 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);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue