Have two ESP32 units, using sketch Code from DroneBot Workshop. Sending myData successfully to receiving unit and printing on LCD screen successfully. How do I get the "myData.x" converted back to the original form so I can make decisions/calculations within the receiving unit?
// Define a data structure typedef struct struct_message { char a[32]; int b; float c; bool d; } struct_message; // Create a structured object struct_message myData;
Have two ESP32 units, using sketch Code from DroneBot Workshop. Sending myData successfully to receiving unit and printing on LCD screen successfully. How do I get the "myData.x" converted back to the original form so I can make decisions/calculations within the receiving unit?
// Define a data structure typedef struct struct_message { char a[32]; int b; float c; bool d; } struct_message; // Create a structured object struct_message myData;
Not sure what you mean, if you mean working with the individual fields, then syntax like myData.b can be read or changed if on other side of the equation. Is that what you wanted to know?
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.
Not quite following your reply. Please give an example about the "other side of the equation". e.g. : a=myData.a
@otto To retrieve data from the structure you would code
b = myData.b;
To store data in the structure you would code
myData.b = b;
Where b is int and myData.b is int
Clear?
of course the char array a requires a little more work, but by now you should understand what is needed.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.
Ron, thanx very much. Have put the equations into the code, but haven't had time to test yet, thanks again
@otto Just remember the char array will need appropriate strxxxx or memxxx helpers depending on if the array is really just a char array or is actually a string. Then you must deal with if the string is /0 terminated or not. I am old school but understand there are C++ things to deal with that situation that I am only vaguely aware of. Perhaps one of our C++ members will chime in.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.