Two Arduino sending Data - PBra - 09-15-2023
Hello every one,
I'd need some help with the writing of an XML file for an experiment in which two arduino send accelerometer data to the phyphox app.
I am completely new to XML languange so any hel will be appreciated.
I am using the experiment editor of phyphox. I'll try to explain what I've done and what I am missing.
-In the Main window of the editor I've just added the title of the experiment
-In the input window I've added two bluetooth modules.- Identification: set to right and left, respectively. I'll move the sensors with my right and left hands
- Device names: right_ARD and left_ARD. I will set the same device names when uploading the codes on the two sensors.
- Service UUID: I've left this blank. To connect the sensors to the app is it sufficient the Device Name or do I need this information as well?
- Mode: Poll. I need the sensors to send data continuously at a sampling rate of 100 Hz (which I put in the following box). is the correct?
- I've checked the Subscribe on start boce as i want to start the experiment manually from the app
- Config: I cannot understand if I have to change something in this case
- Output: From what I understood I should add three outputs, one for each axis of the accelerometer. After this I don't know what should I do. Which of these boxes are mandatory to be filled? I can imagine that as Conversion function I should use some from the Float option as it is the format of the variables that I will use to read the accelerometer data on the arduino (as in the random number experiment for BLE). In the characteristic boxes shoul I put the name of the variables that I will use on the arduino code to store the data?
-I didn't consider the Output window as i don't need the app to send data to the sensors
-Views- I've added two views with three graphs each, one for each component of the accelerometer data.
- I've just change some labels of the graphs and the x y axes
-Analysis- I've just created empty buffers and connected them to the graphs.
This is what I managed to do.
I'll post the code here
Code: <phyphox xmlns="http://phyphox.org/xml" xmlns:editor="http://phyphox.org/editor/xml" version="1.7" editor:version="1.0" locale="en">
<title>Arduino_acc</title>
<category>no category</category>
<description></description>
<icon format="string">ARD</icon>
<data-containers>
<container size="1000" static="false">Output 1</container>
<container size="1000" static="false">Output 2</container>
<container size="1000" static="false">Output 3</container>
<container size="1000" static="false">Output 1 (1)</container>
<container size="1000" static="false">Output 2 (1)</container>
<container size="1000" static="false">Output 3 (1)</container>
</data-containers>
<input>
<bluetooth editor:uuid="98" editor:posx="479.6499938964844" editor:posy="8.112518310546875" id="Right" name="Right_ARD" mode="poll" rate="100" subscribeOnStart="true">
<config conversion="string"></config>
<output char="Racc_x" conversion="string">Output 1 (1)</output>
<output char="Racc_y" conversion="string">Output 2 (1)</output>
<output char="Racc_z" conversion="string">Output 3 (1)</output>
</bluetooth>
<bluetooth editor:uuid="99" editor:posx="18.212499618530273" editor:posy="0" id="Left" name="Left_ARD" mode="poll" rate="100" subscribeOnStart="true">
<config conversion="string"></config>
<output char="Lacc_x" conversion="string">Output 1 (1)</output>
<output char="Lacc_y" conversion="string">Output 2 (1)</output>
<output char="Lacc_z" conversion="string">Output 3 (1)</output>
</bluetooth>
</input>
<output>
</output>
<analysis sleep="0" onUserInput="false">
</analysis>
<views>
<view label="right ">
<graph editor:uuid="130" editor:posx="510.3000183105469" editor:posy="180.4749984741211" label="ACC_R" aspectRatio="2.5" style="lines" lineWidth="1" color="ff7e22" partialUpdate="false" history="1" labelX="time" labelY="X" labelZ="" unitX="" unitY="" unitZ="" logX="false" logY="false" logZ="false" xPrecision="3" yPrecision="3" zPrecision="3" scaleMinX="auto" scaleMaxX="auto" scaleMinY="auto" scaleMaxY="auto" scaleMinZ="auto" scaleMaxZ="auto" minX="0" maxX="0" minY="0" maxY="0" minZ="0" maxZ="0" mapWidth="0" >
<input axis="x">Output 1 (1)</input>
</graph>
<graph editor:uuid="217" editor:posx="509.72503662109375" editor:posy="333.83750915527344" label="ACC_R" aspectRatio="2.5" style="lines" lineWidth="1" color="ff7e22" partialUpdate="false" history="1" labelX="time" labelY="Y" labelZ="" unitX="" unitY="" unitZ="" logX="false" logY="false" logZ="false" xPrecision="3" yPrecision="3" zPrecision="3" scaleMinX="auto" scaleMaxX="auto" scaleMinY="auto" scaleMaxY="auto" scaleMinZ="auto" scaleMaxZ="auto" minX="0" maxX="0" minY="0" maxY="0" minZ="0" maxZ="0" mapWidth="0" >
<input axis="x">Output 2 (1)</input>
</graph>
<graph editor:uuid="230" editor:posx="510.48748779296875" editor:posy="492.5749969482422" label="ACC_R" aspectRatio="2.5" style="lines" lineWidth="1" color="ff7e22" partialUpdate="false" history="1" labelX="time" labelY="Z" labelZ="" unitX="" unitY="" unitZ="" logX="false" logY="false" logZ="false" xPrecision="3" yPrecision="3" zPrecision="3" scaleMinX="auto" scaleMaxX="auto" scaleMinY="auto" scaleMaxY="auto" scaleMinZ="auto" scaleMaxZ="auto" minX="0" maxX="0" minY="0" maxY="0" minZ="0" maxZ="0" mapWidth="0" >
<input axis="x">Output 3 (1)</input>
</graph>
</view>
<view label="left">
<graph editor:uuid="143" editor:posx="18.162500381469727" editor:posy="189.51250457763672" label="ACC_L" aspectRatio="2.5" style="lines" lineWidth="1" color="ff7e22" partialUpdate="false" history="1" labelX="time" labelY="X" labelZ="" unitX="" unitY="" unitZ="" logX="false" logY="false" logZ="false" xPrecision="3" yPrecision="3" zPrecision="3" scaleMinX="auto" scaleMaxX="auto" scaleMinY="auto" scaleMaxY="auto" scaleMinZ="auto" scaleMaxZ="auto" minX="0" maxX="0" minY="0" maxY="0" minZ="0" maxZ="0" mapWidth="0" >
<input axis="x">Output 1 (1)</input>
</graph>
<graph editor:uuid="243" editor:posx="16.800000190734863" editor:posy="343.0749969482422" label="ACC_L" aspectRatio="2.5" style="lines" lineWidth="1" color="ff7e22" partialUpdate="false" history="1" labelX="time" labelY="Y" labelZ="" unitX="" unitY="" unitZ="" logX="false" logY="false" logZ="false" xPrecision="3" yPrecision="3" zPrecision="3" scaleMinX="auto" scaleMaxX="auto" scaleMinY="auto" scaleMaxY="auto" scaleMinZ="auto" scaleMaxZ="auto" minX="0" maxX="0" minY="0" maxY="0" minZ="0" maxZ="0" mapWidth="0" >
<input axis="x">Output 2 (1)</input>
</graph>
<graph editor:uuid="256" editor:posx="14.20001220703125" editor:posy="508.45001220703125" label="ACC_L" aspectRatio="2.5" style="lines" lineWidth="1" color="ff7e22" partialUpdate="false" history="1" labelX="time" labelY="Z" labelZ="" unitX="" unitY="" unitZ="" logX="false" logY="false" logZ="false" xPrecision="3" yPrecision="3" zPrecision="3" scaleMinX="auto" scaleMaxX="auto" scaleMinY="auto" scaleMaxY="auto" scaleMinZ="auto" scaleMaxZ="auto" minX="0" maxX="0" minY="0" maxY="0" minZ="0" maxZ="0" mapWidth="0" >
<input axis="x">Output 3 (1)</input>
</graph>
</view>
</views>
<export>
</export>
</phyphox>
I'll attach the phyphox file here.
If anyone could help me I would be grateful.
Tanks in advance!!
RE: Two Arduino sending Data - PBra - 09-15-2023
Apologies,
the phyphox file attachted in the post is the wrong one.
I'll attach the right one here
RE: Two Arduino sending Data - Jens Noriʇzsɔɥ - 09-15-2023
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
RE: Two Arduino sending Data - PBra - 09-15-2023
(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.
RE: Two Arduino sending Data - Dominik Dorsel - 09-21-2023
Hey,
could you share some more informatione about your current setup? Which microcontroller and software versions (board firmware, library version) are you using? Unfortunately I cannot reproduce this issue.
Cheers
Dominik
RE: Two Arduino sending Data - Jens Noriʇzsɔɥ - 09-21-2023
Me and Dominik have tried to reproduce this bug, however, we could not and all our builds succeeded.
What boards are you using and which versions of IDE, library, and board driver?
RE: Two Arduino sending Data - PBra - 09-21-2023
Thank you to both of you.
I am using an Arduino NANO 33 IoT, with dirvers version 1.4.3.0 on Arduino IDE 2.2.1. The phyphoxBLE library I used was 1.2.0.
Anyway. I tried to installe the 1.1.2 version of the library and I tried to upload the Createexperiment sketch as is.
It is compiling and uploading the sketch but when I try to connect the device to the app it just start loading the experiment but then do nothing.
After this I tried to search again for the device and the app didn't find it.
Just once I got this error message on the app:
"it is not possible to abilitate the notification of the Bluetooth Characteristic with UUID cddf0002-30f7-4671-8b43-5e40ba53514a."
Now if I try to upload the sketch again or any other sketch on the board the Arduino IDE compiles the sketch but then doesn't upload it without giving any error.
RE: Two Arduino sending Data - Jens Noriʇzsɔɥ - 10-04-2023
(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-arduino/commit/377e92a9fb64d8bafdfb3072f0964da2c0ef1ff3, as a temporary measure until the update is released. The library is put into your Arduino sketch folder.
|