10-04-2023, 11:12 AM
(09-15-2023, 09:07 PM)PBra Wrote: 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.
Dominik could fix this bug that is surprisingly not triggered on other boards. We should do a bit of testing before we release it.
You could add one line, see https://github.com/Dorsel89/phyphox-ardu...a2c0ef1ff3, as a temporary measure until the update is released. The library is put into your Arduino sketch folder.

