Interface and Application Programming

by Dhruv Saidava




Assignment

write an application that interfaces with an input and/or output device that you made,
comparing as many tool options as possible


Bluetooth controlled bot

Procesing


For interface and application programming, I decided to use Processing to generate a graphic from output generated from distance sensor.

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.

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 the code was working

I could move the line using the output from distance sensor.

I used FTDI cable to connect the board to the computer to transfer output distance values from distance sensor board to Processing.