Interface Design

Intro

This week's assignment was to design an interface to interact with an input or output device. I used the echo hello world board I created several weeks ago and created an interface for it on my computer. My echo hello world board has a button so I created an interface to display the number of times the button has been pushed. My interface also has a reset button that allows the user to reset the count at 0 by clicking on the computer.


Processing

Processing feels very similar to Arduino and uses alot of the same syntax so its very easy to use the two of them together. Processing can be downloaded for free and has several tutorials for getting started. Basically I just watched a few tutorials to get the hang of basic commands like rect() for drawing rectangles and text() (with its associated initialization functions) to write things to the screen. After that, it was pretty intuitive and easy to borrow pieces of other code that start serial communication. The most challenging part was figuring out a way to get Processing and Arduino to communicate back and forth with the correct timing. In my program, I wanted the counter on the screen to count up every time the physical button was pushed, and I wanted to be able to reset the count by hitting a virtual button in Processing. I accomplished this by serial writing from each program whenever their respective buttons were pushed and serial reading into each program whenever data was available on the serial port. Probably the most helpful thing for anyone to learn from this would be just to take a look at both of the codes included below.

Arduino Code

Processing Code



Home