Maxwell Jarosz

Application and Interface Programming


Using my motion sensor from the previous week, I will be testing out Processing to draw a box that turns Magenta when there is motion and it will be empty when there is none.

 

The first step from what I understand is to use Firmata in arduino to communicate and allow processing to read from the device.

 

After trying unsuccesfully to use this firmata, I realized I had made an extremely dumb mistake and was trying to use FireFly firmata instead of Standard Firmata. After Correcting this I was ready to move onto processing.

With some quick lines of codes after defining my serial port you can start to call out drawing methods. Processing has a list of default things it can draw such as lines, rectangles.

I used:

rect (0,400,0,400) //defines the rectangles side by x position, width, y position height.
fill (0,0,0) // turns all color off.

For the on stage I used:

rect (0,400,0,400) // You want this to be in the same position, however you could define the width in an analog input to be something like x+value to have it move and correlate with the input data. Since mine is HIGH/Low there is no point to doing this so I just filled the entire rectangle.
fill (255,0,255) //turns on red and blue to make magenta.

 

Here is a video:

Video

And the processing Script for download here.

Get in Touch

  • Phone:
    815-545-6414
  • Email:
    mjarosz@mit.edu