This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MPU-9250 and BME280 to OpenPlotter
#4
(2020-06-17, 09:04 AM)Barentsailor Wrote: Is there someone with experience with this? I think a good tutorial about generating code for SignalK data could benefit a lot.

You could try this :-
At the top paste this line >

Code:
#include "ArduinoJson.h"

then 
Code:
void sendSigK(String sigKey, float data)
{

   DynamicJsonBuffer jsonBuffer;
   String deltaText;

   //  build delta message
   JsonObject &delta = jsonBuffer.createObject();

   //updated array
   JsonArray &updatesArr = delta.createNestedArray("updates");
   JsonObject &thisUpdate = updatesArr.createNestedObject();   //Json Object nested inside delta [...
   JsonArray &values = thisUpdate.createNestedArray("values"); // Values array nested in delta[ values....
   JsonObject &thisValue = values.createNestedObject();
   thisValue["path"] = sigKey;
   thisValue["value"] = data;

   thisUpdate["Source"] = "ESP32";

   delta.printTo(Serial);
   Serial.println();
 
}
 Cut and paste above void loop() then in the main loop below 

'temp = pressure.readTemperature();

  press = pressure.readPressure();'

paste >

Code:
sendSigK("environment.outside.pressure", press);
sendSigK("environment.outside.temperature", temp );

Untested but might work first time, maybe.... Smile
Reply


Messages In This Thread
RE: MPU-9250 and BME280 to OpenPlotter - by PaddyB - 2020-06-17, 09:39 AM

Forum Jump:


Users browsing this thread: 2 Guest(s)