Share My Creation Serial Connector Graph

I have uploaded a tool I called the Serial Connector Graph.

It allows you to send data points from the Arduino that will be plotted on a bar graph or you can also send log text messages that will be shown in a text area.

I find it is sometimes easier to visualize data when it's presented in a graph format (for example, if you are looking at the output of an FFT).

The SGC is based on Erel's Serial Connector. It consists of two applications, one for B4J and a second that runs on an Arduino type board for B4R.

I have attached the source code for both applications attached in a zip file to this post.

Below is the output window of the B4J application when running my example.

upload_2016-5-22_16-40-53-png.44310


The zip file contains two other zip files, one for B4R and one for B4J.

The B4R application uses version 1.0 of the compiler.

After opening the .b4r file and connecting your board, be sure to select the Tools-Board Selector menu item to set the Board Type, Serial Port, Baud Rate, and be sure the B4J Serial Connector radiobutton is selected.

Compile, install, and run this application on your board. As a note, I ran this successfully on an Arduino Mega, but it did not run properly on my WeMos D1 R2.

The B4J application uses the latest version, 4.20 (1).

Before opening the .b4j application you need to be sure you have the latest version of the jNetwork Library, v1.20+:
https://www.b4x.com/android/forum/threads/updates-to-internal-libaries.48274/#post-418884

Compile and run the B4J application. You'll see a dialog that looks like the image above without the graph showing. The left-hand text area is a log window. The right-hand Pane is the graph area. The Send button is used to send "commands" to the Arduino.

Choose the Serial Port connecting to the Arduino from the drop-down and press the Open button.

In my example I've defined a command "go" as the command to tell the Arduino to send example data points that will be graphed in a bar graph. Type go into the text field and press Send.

The Arduino will respond by sending the graph data points.

The Arduino sends byte arrays of text in the format:
log=message, to send a log message that will appear in the left-hand text area.
plot=[comma separated data points], to send data that will be plotted on the bar graph.

Admittedly this application is currently very crude – there are many improvements that could be made.

Please upload and share any improvements you make.

Barry.
 

Attachments

  • Serial_Conn_Graph C Exp.zip
    5.8 KB · Views: 650
Last edited:
Top