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.

Two Arduino sending Data
#4
(09-15-2023, 03:45 PM)Jens Noritzsch Wrote: What are you using on the Arduino side: phyphoxBLE? I would likely use our library for both microcontrollers and merge the two generated experiments into one by a text editor.

On first sight, both BLE characteristics write into the same buffer, accordingly you have two identical graphs. I assume that is not intended…

Answers to some of your questions:
  • the UUID is (mainly) a generic identifier for heart rate monitors, HID services etc.,
  • “notification” mode lets the microcontroller set the rate, we mainly use this ourselves,
  • phyphox does not record data before tapping start, so likely no subscribeOnStart required
  • conversion indicates to phyphox how the data is transmitted, float or integer requires the lowest amount of data (again: phyphoxBLE would take care of that and you could look into the generated experiment)

There is some documentation on Bluetooth Low Energy in phyphox at https://phyphox.org/wiki/index.php/Bluetooth_Low_Energy

Thank you very much Jens, 

I've tried the solution you suggested but I couldn't upload the sketch on the board as it gives my error. 
This is the sketch I've written following the example that I found on github "CreateExperiment"

Code:
#include <phyphoxBle.h>
#include <Arduino_LSM6DS3.h>

void setup()
{
  Serial.begin(115200);
  PhyphoxBLE::start("get_acc");

  //Experiment
  PhyphoxBleExperiment GetACC_From_ARDUINO;  


  GetACC_From_ARDUINO.setTitle("get_acc");
  GetACC_From_ARDUINO.setCategory("Arduino Experiments");
  GetACC_From_ARDUINO.setDescription("Random numbers are generated on Arduino and visualized with phyphox afterwards");

  //View
  PhyphoxBleExperiment::View firstView;
  firstView.setLabel("FirstView"); //Create a "view"
  //PhyphoxBleExperiment::View secondView;
  //secondView.setLabel("SecondView"); //Create a "view"

  //Graph
  PhyphoxBleExperiment::Graph firstGraph;      //Create graph which will plot random numbers over time
  firstGraph.setMinY(0, LAYOUT_FIXED);
  firstGraph.setMaxY(1000, LAYOUT_FIXED);
  firstGraph.setLabel("Acceleration");
  firstGraph.setUnitX("s");
  firstGraph.setUnitY("m/s^2");
  firstGraph.setLabelX("time");
  firstGraph.setLabelY("Acc");
  firstGraph.setXPrecision(1);                 //The amount of digits shown after the decimal point
  firstGraph.setYPrecision(1);

  /* Assign Channels, so which data is plotted on x or y axis
     first parameter represents x-axis, second y-axis
     Channel 0 means a timestamp is created after the BLE package arrives in phyphox
     Channel 1 to N corresponding to the N-parameter which is written in server.write()
  */

  firstGraph.setChannel(0, 1);
 
  //Second Graph
  PhyphoxBleExperiment::Graph secondGraph;      //Create graph which will plot random numbers over time
  secondGraph.setMinY(0, LAYOUT_FIXED);
  secondGraph.setMaxY(1000, LAYOUT_FIXED);
  secondGraph.setLabel("Acceleration");
  secondGraph.setUnitX("s");
  secondGraph.setUnitY("m/s^2");
  secondGraph.setLabelX("time");
  secondGraph.setLabelY("Acc");
  secondGraph.setXPrecision(1);                 //The amount of digits shown after the decimal point
  secondGraph.setYPrecision(1);


   /* Assign Channels, so which data is plotted on x or y axis
     first parameter represents x-axis, second y-axis
     Channel 0 means a timestamp is created after the BLE package arrives in phyphox
     Channel 1 to N corresponding to the N-parameter which is written in server.write()
  */

  secondGraph.setChannel(0, 2);

  //Third Graph
  PhyphoxBleExperiment::Graph thirdGraph;      //Create graph which will plot random numbers over time
  thirdGraph.setMinY(0, LAYOUT_FIXED);
  thirdGraph.setMaxY(1000, LAYOUT_FIXED);
  thirdGraph.setLabel("Acceleration");
  thirdGraph.setUnitX("s");
  thirdGraph.setUnitY("m/s^2");
  thirdGraph.setLabelX("time");
  thirdGraph.setLabelY("Acc");
  thirdGraph.setXPrecision(1);                 //The amount of digits shown after the decimal point
  thirdGraph.setYPrecision(1);


   /* Assign Channels, so which data is plotted on x or y axis
     first parameter represents x-axis, second y-axis
     Channel 0 means a timestamp is created after the BLE package arrives in phyphox
     Channel 1 to N corresponding to the N-parameter which is written in server.write()
  */

  thirdGraph.setChannel(0, 3);
 

  //Info
  //PhyphoxBleExperiment::InfoField myInfo;      //Creates an info-box.
  //myInfo.setInfo("This is an Info field!");
  //myInfo.setColor("890128");                   //Sets font color. Uses a 6 digit hexadecimal value in "quotation marks".
  //myInfo.setXMLAttribute("size=\"1.2\"");

  //Separator
  //PhyphoxBleExperiment::Separator mySeparator;      //Creates a line to separate elements.
  //mySeparator.setHeight(0.3);                       //Sets height of the separator.
  //mySeparator.setColor("404040");                   //Sets color of the separator. Uses a 6 digit hexadecimal value in "quotation marks".

  //Value
  //PhyphoxBleExperiment::Value myValue;         //Creates a value-box.
  //myValue.setLabel("Number");                  //Sets the label
  //myValue.setPrecision(2);                     //The amount of digits shown after the decimal point.
  //myValue.setUnit("unit");                        //The physical unit associated with the displayed value.
  //myValue.setColor("FFFFFF");                  //Sets font color. Uses a 6 digit hexadecimal value in "quotation marks".
  //myValue.setChannel(0);
  //myValue.setXMLAttribute("size=\"2\"");

  //Export
  PhyphoxBleExperiment::ExportSet mySet;       //Provides exporting the data to excel etc.
  mySet.setLabel("mySet");
  PhyphoxBleExperiment::ExportData myData1;
  myData1.setLabel("myData1");
  myData1.setDatachannel(1);

  PhyphoxBleExperiment::ExportData myData2;
  myData2.setLabel("myData2");
  myData2.setDatachannel(2);

  PhyphoxBleExperiment::ExportData myData3;
  myData3.setLabel("myData3");
  myData3.setDatachannel(3);

  //attach to experiment

  firstView.addElement(firstGraph);            //attach graph to view
  firstView.addElement(secondGraph);            //attach second graph to view
  firstView.addElement(thirdGraph);            //attach second graph to view
  //secondView.addElement(myInfo);                //attach info to view
  //secondView.addElement(mySeparator);          //attach separator to view
  //secondView.addElement(myValue);               //attach value to view

  GetACC_From_ARDUINO.addView(firstView);         //attach view to experiment
 
  mySet.addElement(myData1);                   //attach data to exportSet
  mySet.addElement(myData2);                   //attach data to exportSet
  mySet.addElement(myData3);                   //attach data to exportSet
  GetACC_From_ARDUINO.addExportSet(mySet);        //attach exportSet to experiment
  PhyphoxBLE::addExperiment(GetACC_From_ARDUINO);      //attach experiment to server
}


void loop()
{
  float x, y, z;
  IMU.readAcceleration(x, y, z);
  /*  The random number is written into Channel 1
      Up to 5 Channels can written at the same time with server.write(randomDistance, valueChannel2, valueChannel3.. )
  */
  PhyphoxBLE::write(x,y,z);
  delay(50);

  PhyphoxBLE::poll(); //Only required for the Arduino Nano 33 IoT, but it does no harm for other boards.
}


when I try to upload the sketch I get this error 


Code:
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\errorhandler.cpp: In member function 'virtual PhyphoxBleExperiment::Error PhyphoxBleExperiment::Errorhandler::err_checkLength(const char*, int, const char*)':
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\errorhandler.cpp:8:55: error: 'string' is not a member of 'std'
         copyToMem(&ret.MESSAGE, ("ERR_01, in " + std::string(origin) + "(). \n").c_str());
                                                       ^~~~~~
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\errorhandler.cpp:8:55: note: suggested alternative: 'trunc'
         copyToMem(&ret.MESSAGE, ("ERR_01, in " + std::string(origin) + "(). \n").c_str());
                                                       ^~~~~~
                                                       trunc
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\errorhandler.cpp: In member function 'virtual PhyphoxBleExperiment::Error PhyphoxBleExperiment::Errorhandler::err_checkUpper(int, int, const char*)':
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\errorhandler.cpp:16:55: error: 'string' is not a member of 'std'
         copyToMem(&ret.MESSAGE, ("ERR_02, in " + std::string(origin) + "(). \n").c_str());
                                                       ^~~~~~
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\errorhandler.cpp:16:55: note: suggested alternative: 'trunc'
         copyToMem(&ret.MESSAGE, ("ERR_02, in " + std::string(origin) + "(). \n").c_str());
                                                       ^~~~~~
                                                       trunc
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\errorhandler.cpp: In member function 'virtual PhyphoxBleExperiment::Error PhyphoxBleExperiment::Errorhandler::err_checkHex(const char*, const char*)':
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\errorhandler.cpp:24:55: error: 'string' is not a member of 'std'
         copyToMem(&ret.MESSAGE, ("ERR_03, in " + std::string(origin) + "(). \n").c_str());
                                                       ^~~~~~
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\errorhandler.cpp:24:55: note: suggested alternative: 'trunc'
         copyToMem(&ret.MESSAGE, ("ERR_03, in " + std::string(origin) + "(). \n").c_str());
                                                       ^~~~~~
                                                       trunc
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\errorhandler.cpp:28:59: error: 'string' is not a member of 'std'
             copyToMem(&ret.MESSAGE, ("ERR_03, in " + std::string(origin) + "(). \n").c_str());
                                                           ^~~~~~
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\errorhandler.cpp:28:59: note: suggested alternative: 'trunc'
             copyToMem(&ret.MESSAGE, ("ERR_03, in " + std::string(origin) + "(). \n").c_str());
                                                           ^~~~~~
                                                           trunc
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\errorhandler.cpp: In member function 'virtual PhyphoxBleExperiment::Error PhyphoxBleExperiment::Errorhandler::err_checkStyle(const char*, const char*)':
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\errorhandler.cpp:37:55: error: 'string' is not a member of 'std'
         copyToMem(&ret.MESSAGE, ("ERR_04, in " + std::string(origin) + "(). \n").c_str());
                                                       ^~~~~~
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\errorhandler.cpp:37:55: note: suggested alternative: 'trunc'
         copyToMem(&ret.MESSAGE, ("ERR_04, in " + std::string(origin) + "(). \n").c_str());
                                                       ^~~~~~
                                                       trunc
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\errorhandler.cpp: In member function 'virtual PhyphoxBleExperiment::Error PhyphoxBleExperiment::Errorhandler::err_checkLayout(const char*, const char*)':
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\errorhandler.cpp:44:51: error: 'string' is not a member of 'std'
     copyToMem(&ret.MESSAGE, ("ERR_05, in " + std::string(origin) + "(). \n").c_str());
                                                   ^~~~~~
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\errorhandler.cpp:44:51: note: suggested alternative: 'trunc'
     copyToMem(&ret.MESSAGE, ("ERR_05, in " + std::string(origin) + "(). \n").c_str());
                                                   ^~~~~~
                                                   trunc
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\errorhandler.cpp: In member function 'virtual PhyphoxBleExperiment::Error PhyphoxBleExperiment::Errorhandler::err_checkSensor(const char*, const char*)':
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\errorhandler.cpp:51:55: error: 'string' is not a member of 'std'
         copyToMem(&ret.MESSAGE, ("ERR_04, in " + std::string(origin) + "(). \n").c_str());
                                                       ^~~~~~
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\errorhandler.cpp:51:55: note: suggested alternative: 'trunc'
         copyToMem(&ret.MESSAGE, ("ERR_04, in " + std::string(origin) + "(). \n").c_str());
                                                       ^~~~~~
                                                       trunc
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\errorhandler.cpp: In member function 'virtual PhyphoxBleExperiment::Error PhyphoxBleExperiment::Errorhandler::err_checkComponent(const char*, const char*)':
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\errorhandler.cpp:59:55: error: 'string' is not a member of 'std'
         copyToMem(&ret.MESSAGE, ("ERR_04, in " + std::string(origin) + "(). \n").c_str());
                                                       ^~~~~~
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\errorhandler.cpp:59:55: note: suggested alternative: 'trunc'
         copyToMem(&ret.MESSAGE, ("ERR_04, in " + std::string(origin) + "(). \n").c_str());
                                                       ^~~~~~
                                                       trunc
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\element.cpp: In member function 'virtual void PhyphoxBleExperiment::Element::setLabel(const char*)':
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\element.cpp:6:26: error: 'string' is not a member of 'std'
  copyToMem(&LABEL, (std::string(l)).c_str());
                          ^~~~~~
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\element.cpp:6:26: note: suggested alternative: 'trunc'
  copyToMem(&LABEL, (std::string(l)).c_str());
                          ^~~~~~
                          trunc
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\edit.cpp: In member function 'void PhyphoxBleExperiment::Edit::setUnit(const char*)':
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\edit.cpp:7:28: error: 'string' is not a member of 'std'
     copyToMem(&UNIT, (std::string(u)).c_str());
                            ^~~~~~
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\edit.cpp:7:28: note: suggested alternative: 'trunc'
     copyToMem(&UNIT, (std::string(u)).c_str());
                            ^~~~~~
                            trunc
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\edit.cpp: In member function 'void PhyphoxBleExperiment::Edit::setXMLAttribute(const char*)':
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\edit.cpp:24:39: error: 'string' is not a member of 'std'
  copyToMem(&XMLAttribute, (" " + std::string(xml)).c_str());
                                       ^~~~~~
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\edit.cpp:24:39: note: suggested alternative: 'trunc'
  copyToMem(&XMLAttribute, (" " + std::string(xml)).c_str());
                                       ^~~~~~
                                       trunc
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\exportSet.cpp: In member function 'void PhyphoxBleExperiment::ExportSet::setLabel(const char*)':
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\exportSet.cpp:16:39: error: 'string' is not a member of 'std'
  copyToMem(&LABEL, (" name=\"" + std::string(l) + "\"").c_str());
                                       ^~~~~~
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\exportSet.cpp:16:39: note: suggested alternative: 'trunc'
  copyToMem(&LABEL, (" name=\"" + std::string(l) + "\"").c_str());
                                       ^~~~~~
                                       trunc
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\exportSet.cpp: In member function 'void PhyphoxBleExperiment::ExportSet::setXMLAttribute(const char*)':
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\exportSet.cpp:20:39: error: 'string' is not a member of 'std'
  copyToMem(&XMLAttribute, (" " + std::string(xml)).c_str());
                                       ^~~~~~
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\exportSet.cpp:20:39: note: suggested alternative: 'trunc'
  copyToMem(&XMLAttribute, (" " + std::string(xml)).c_str());
                                       ^~~~~~
                                       trunc
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\experiment.cpp: In member function 'void PhyphoxBleExperiment::setColor(const char*)':
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\experiment.cpp:73:26: error: 'string' is not a member of 'std'
  copyToMem(&COLOR, (std::string(c)).c_str());
                          ^~~~~~
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\experiment.cpp:73:26: note: suggested alternative: 'trunc'
  copyToMem(&COLOR, (std::string(c)).c_str());
                          ^~~~~~
                          trunc
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\exportdata.cpp: In member function 'void PhyphoxBleExperiment::ExportData::setXMLAttribute(const char*)':
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\exportdata.cpp:11:40: error: 'string' is not a member of 'std'
   copyToMem(&XMLAttribute, (" " + std::string(xml)).c_str());
                                        ^~~~~~
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\exportdata.cpp:11:40: note: suggested alternative: 'trunc'
   copyToMem(&XMLAttribute, (" " + std::string(xml)).c_str());
                                        ^~~~~~
                                        trunc
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\exportdata.cpp: In member function 'virtual void PhyphoxBleExperiment::ExportData::setLabel(const char*)':
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\exportdata.cpp:16:26: error: 'string' is not a member of 'std'
  copyToMem(&LABEL, (std::string(l)).c_str());
                          ^~~~~~
C:\Users\paolo\Documents\Arduino\libraries\phyphox_BLE\src\exportdata.cpp:16:26: note: suggested alternative: 'trunc'
  copyToMem(&LABEL, (std::string(l)).c_str());
                          ^~~~~~
                          trunc

exit status 1

Compilation error: exit status 1



I've even tried to upload the original CreateExperiment skech but it gives me the same error
I'm stuck here for now.
Reply


Messages In This Thread
Two Arduino sending Data - by PBra - 09-15-2023, 12:29 AM
RE: Two Arduino sending Data - by PBra - 09-15-2023, 11:11 AM
RE: Two Arduino sending Data - by PBra - 09-15-2023, 09:07 PM
RE: Two Arduino sending Data - by Dominik Dorsel - 09-21-2023, 10:33 AM
RE: Two Arduino sending Data - by PBra - 09-21-2023, 12:02 PM

Forum Jump: