16 • Interface and Application Programming

Assignment: write an application that interfaces with an input and/or an output

For the interface and application programming week, I worked with Barbara Drozdek again since we did inputs device week together and for this one we are using our hello.mag.45 board, the one that has the hal sensor to measure magnetic fields. As we did the assignment for that week, we had already been in touch with interfaces to visualize the measurement of magnetic fields. We downloaded a set of interfaces developed by Carolina Vignoli with Processing.

For our assignment this week, we played with her interfaces and build our upon a code made available by her and created by Simon Greenwold.

We connected the hello.mag.45 board to the computer. With the code, we changed the USB port number according to the one of the computer (COM4). The code basically displays a shape with three different colors of light. Depending on how you move the sensor, the lights and the shape move. We started playing in changing parameters for the color of the lights. First, we learned that in Processing, the colors are displayed in RGB mode. This tutorial about colors from the Processing webpage is very informative. We selected different colors for the three lights: pink, purple and cyan.

Colors defined for the lights

After that, we wanted to change the shape. We discovered that there are only two primitive shapes available on Processing: box and sphere. It is also possible to custom these shapes by calling “vertex()”. We learned these basic principles after reading this tutorial called P3D on the Processing webpage. Then we checked out other kinds of shapes, not necessarily 3D ones. PShapes are the primitive shapes and we chose to use in our code the triangle. Further information about shapes can be seen in this link.

Defined shape

The final outcome can be seen below.

Final interface

Download the file