Week 13

Interface and Application Programming

  • Group assignment
  • Compare as many tool options as possible.
  • Individual assignment
  • Write an application that interfaces a user with an input and/or output device that you made



Programing

This week we compared diffrent programing languages and got a local lecture on Python. After exploring various programing languages I decided to work with Prossesing and Java.

Prossesing

Processing is a flexible software sketchbook and a language for learning how to code within the context of the visual arts. Since 2001, Processing has promoted software literacy within the visual arts and visual literacy within technology. There are tens of thousands of students, artists, designers, researchers, and hobbyists who use Processing for learning and prototyping.

Processing uses the Java language, with additional simplifications such as additional classes and aliased mathematical functions and operations. It also provides a graphical user interface for simplifying the compilation and execution stage.

The Processing language and IDE have been the precursor to other projects including Arduino, Wiring and P5.js.

Java

Java is a general-purpose programming language that is class-based, object-oriented, and designed to have as few implementation dependencies as possible. It is intended to let application developers write once, run anywhere (WORA),[16] meaning that compiled Java code can run on all platforms that support Java without the need for recompilation.[17] Java applications are typically compiled to bytecode that can run on any Java virtual machine (JVM) regardless of the underlying computer architecture. The syntax of Java is similar to C and C++, but it has fewer low-level facilities than either of them. As of 2019, Java was one of the most popular programming languages in use according to GitHub,[18][19] particularly for client-server web applications, with a reported 9 million developers.[20]



To install Prossesing we have to go to this website and download the software

https://processing.org/download/


After we have installed the software we have to add some libraries

To do that we can go to Sketch-> Import library-> Add library



To find the correct libraries we can type in the search window.

I typed Serial to install the Vsync for Processing. That library will enable me to talk to the Arduino program



For my project I will also need this library that is called Grafica. It will enable me to do a 2d plot.



To test if our connections between Arduion and Prossesing I did a simple port test program. We directed the program to go to correct pin before we compiled the code for Prossessing

Here is the code that I made in Arduino

[ ON_OFF_apr28a.ino ]


Program interfacing

To make a connection between Arduino and the Prossesing program we have to direct the program to listen to a serial port.

To install a Example serial program. We go to File -> Examples -> Libraries -> Serial -> SimpleRead



To enable this Java Program to get information from my Attiny 1614 board we have to let it now on what Com port it has to listen to.



My board is connected to the "Com8" port on my computer. We also have to include quotation marks to let the program now it is a Com port




Here we made the program display 2 colors if the pins are connected it will change color and change back when disconnected








Here we have changed the code to display ON / OFF text





Hall sensor

I then connected my hall sensor board to my Attiny 1614 board and did some more coding to make it count every time the magnet passes the Hall sensor.







Code

Here is the program I made in Arduino to make the Hall Sensor count every time a magnet passes the sensor

[ speed_testrpm.ino ]

Here is also the SimpleRead file Interface program that I tweaked in Prossesing to make it work for my hall sensor

[ SimpleRead.pde ]

Magnús St. Magnússon © 2020| v1

Madefor FabAcademy