Write an application that interfaces a user with an input and/or output device that you made
Compare as many tool options as possible (Group Assignment)
Interfacing with an input device
I chose Processing as a software tool to program my application. Processing is totally new to me, so I used a tutorial provided by Nada, my classmate in Fabacademy, to learn the basics of developing an interface using processing.
I started with a simple tutorial of drawing a bus that moves as I move the mouse cursor on the screen.
Demo video:
To actually do this week's task, our local instructor, helped us to use an input device to interface with one of Processing examples' GUI.
We worked on the Bounce example in Processing. In the original example, a white ball bounced inside the frame of the GUI. We changed the code to trigger the balls movement on the screen with an input device.
For this task, I used my hello echo board from the electronics device week. We used the button integrated on the board as an input device to trigger the ball's movement.
But first, we needed to program the board to communicate with the interface through the FTDI.
For this purpose, we used Neil's Hello communication code to establish a communication link.
The last line in the code puts a character (1) on the Tx pin of the board when the button is pressed
So, in the bounce example, we added a line of code, for the computer to listen to an incoming character of (1), and if the character came in, Processing excutes bouncing routine.
Here is a demo video, when I press the button the ball moves and bounce, when I release it the ball stops.
Now to create my own application, I was inspired by my final project idea, to draw a robotic face that can be controlled using the button on the board. When the button is pressed, the eyes get crossed, and when released the eyes go back to its original position.
First, I started with drawing the face, each point on the screen has its X & Y coordinates, so before actually coding I sketched the robotic face and mapped each point.
Then, I coded each line and shape using these point.
The end result:
To interface with the hello echo board, the application listens to the character (1) to excute the action.
When the button is pressed, the two black circles (the pupils) move within the boundery of the surrounding circle (the eyes) until hitting that boundery. When the button is released, the pupils go to it original position.