Week 16: Interface and application programming

This week we have to write an application that interfaces with an input &/or output device that we made,comparing as many tool options as possible.

processing

Processing

Processing is a software that allows you to graphicaly interact with your serial ports. Instead of writing codes that will define inputs and outputs,like in Arduino, here we write codes that define graphical behaviours that respond to the serial ports.

So basically it allows you give graphical visualisation of your serial communications.

I would like to try to plot the temperature in real time using my HelloTempBoardmade during the Week 11.

How to instal it on Ubuntu 14.04:

First download it from the official Processing webpage


Exctract the file "processing-3.1.1-64linux.tgz"

Then open a terminal and go into the folder "processing-3.1.1"

Simply execute :"sh processing" , you should see the IDE appear:

processing ide

You can already start playing with all the exemples:

planets shiny!

If you get errors with some exemples, check you version of Java: "java -version" , if it is missing or not up to date, you can visit this page: How to install Java.



Arduino+Processing:

How to "link" them ?

Once you wrote your sketch in Arduino, you will need to write down an other sketch in Processing, you will have to specify the serial ports you are using .

So first go check in Arduino what port you are using:

Arduino port

In my case I am using the "/dev/ttyUSB1" port. Next we need to go in processing and right down this little skecth and compile it:

sketch

This will give you all the serial ports on your computer: (they'll apear in the prompt)

finding the serial port!

And you should see that one of them is the one your were using in Arduino , so you need to know what is his position, so simply count (remebering that in computer science you start couting at "0" ).

In my case its in position 32, so when I'll want to link Processing to my serial port I'll just need to specify that number in the "portName":

puting the correct port!

Plotting the temperature

I didn't manage to plot the temperature of my HelloTempBoard correctly, I only managed to plot random values:

plotting randomness

This is the explanation that I found:

"Processing receives the values separated as ascii-values ---> asciitable:

  • 10 ... line feed
  • 13 ... carriage return
  • 49 ... number 1
  • 10 and 13 are sent because you use println... which prints the number and a new line. so you have to assemble the values in processing by yourself."

    I remember I had no problem using Processing with Arduino , on Week 5, I used it to make a radar to simulate a 3D scanner:

    graph radar1 graph radar5

    And it was using the same kind of code, the only difference is that I was on Windows 10, so I need to continue to look for an explanation.

    In the mean time, I want to try to learn some Java



    Learn Make Share