Saving interface values

Support forum for MegunoLink
Post Reply
leon
Posts: 3
Joined: Tue Nov 12, 2019 2:13 am

Tue Nov 12, 2019 2:40 am

I am playing around with collecting pressure reading via a 0.5v-4.5V pressure transducer using an Ardunio Uno board.
In a particular test "run", pressure reading are captured depending on the state of three states of a switch. The pressure value is passed to the interface for display.
This all works as I intended.
What I would value is being able to display "run" values in a simple table format on the interface. Subsequent "run" data would append to the bottom of the table.
Ideally each time a run is completed the row data would be appended to a *.csv data file.

Is there an object in the interface tool box that are suitable for the display of the "run data" in a row format.
eg time, pressure value1, pressure value2, pressure value3
Do I have to pass the interface values that I wish to save, back to Arduino for parsing, before passing the values back to the interface to save to file? Alternatively can I save data directly from the interface?

Is there a diagram that shows the best way for programming control?

Regards Leon

PS.. Im new to Megunolink :-)
leon
Posts: 3
Joined: Tue Nov 12, 2019 2:13 am

Wed Nov 13, 2019 9:31 am

I have found a solution.
Regards Leon
philr
Posts: 298
Joined: Mon May 26, 2014 10:58 am

Thu Nov 14, 2019 7:50 am

Hi Leon, great work. I was actually thinking about the best way to do this. What did you come up with in the end?

I would probably have used the message monitor/logger to capture the CSV data and maybe a way to display some of the readings on the interface panel.

Cheers
Phil
leon
Posts: 3
Joined: Tue Nov 12, 2019 2:13 am

Thu Nov 14, 2019 9:37 am

Gday Phil,
Im obtaining analog pressure readings from a 0.5-4.5v pressure transducer and converting the voltage to pressure in BAR.
The pressure data is passed to the interface and displayed as a gauge.

. . . . .
//Update interface panel with transducer value
MyPanel.SetNumber(F("MyGauge"), pressure_bar);
. . . . .


The three pressure reading I after can change depending on the state of a pneumatic/mechanical switch. These values are displayed on the interface and however the values are stored as variables in Arduino

. . . . .
//Set the A-Reading to the text box on the interface
MyPanel.SetText(F("Text_A-Reading"), pressure_bar);

//store the A-Reading locally for later reuse
_AReadingValue = pressure_bar;
. . . . .


There is also a user entered text field "depth" on the interface.

The once all three pressure values have been obtained ie at the end of the test, there is a button on the interface to save the pressure values.

The button event sends the user entered "depth value" back to the Arduino via a command as a parameter.

. . . . .
//Command initiated from the visualiser
//Collects A, B and C Readings from local variables and saves them to file via messenger
void Cmd_SaveReading(CommandParameter &Parameters){
// Retrieve the test depth value from the interface
_TestDepth = Parameters.NextParameter();

. . . . .


The local variables for the pressure reading and the depth value are parsed into *csv format and sent back to the interface as a message and displayed in message monitor.
. . . . .
MyCSVMessage.Begin();
Serial.print(_TestDepth);
Serial.print(",");
Serial.print(_AReadingValue);
Serial.print(",");
Serial.print(_BReadingValue);
Serial.print(",");
Serial.print(_CReadingValue);
MyCSVMessage.End();
. . . . .


Each test is stored as a new line in message monitor where they can be save to the computer file system.

The UI will be increase in functionality and the usability be refined.

Dont know if this is the most efficient way but it works.

If you have an alternative methodology I think myself and others would benefit from some technical documentation on how to pass messages back and forth between an interface and Arduino.

Cheers Leon
philr
Posts: 298
Joined: Mon May 26, 2014 10:58 am

Sun Nov 17, 2019 3:45 am

Hi Leon, nope that sounds like a good way to do it to me. Nice work!

Cheers
Phil
Post Reply