FabLab Cept
PROCESSING
For interface and application programming, I decided to use Processing to generate a graphic from output generated from distance sensor.
So, my final project has distance sensor to detect motion around the system. So, I tried to show the proximity of object to the distance sensor by remapping the output derived from distance sensor to a graphical representation of 2 lines, where 1 line is constant, indicating the location of distance sensor and the other line moves indicating the movement of the object around the sensor.
In terms of electronics, I used the same board that I made for Networking. It was already programmed to give output in terms of distance in centimeters. I tried to make a processing code to interpret this number and move the line accordingly.
The code for Arduino can be found here.
Here is a range of screenshots demonstrating the process I tried.
First step was to set up the screen size and background.
And here I generated the vertical constant line. However , processing considers 0,0 at top left, So I had to change the line co-ordinates.
Here is the changed output.
Next I made a constant horizontal line.
Changing the colour of the bottom line.
Next I created a vertical line, it is fixed at the moment, however I intend to change its co-ordinates based on the data generated from Distance sensor.
Importing Serial I/O library.
Importing Serial I/O library.
Adding steps to receive data from serial port.
Adding the code to read port name
There were some small errors throughout the process.
Adding variable for co-ordinates of line.
I had some issues converting the distance output to integer, so trying different things to fix it.
Errors
Defining "x" as float
Finally my code was working
I could move the line using the output from distance sensor.
15 - 18
<
>
I used FTDI cable to connect my board to the computer to transfer output distance values from distance sensor board to Processing. Here is a final video of my working code. You can find the code here.