Skip to content

Interface and Application Programming

Task progress
Linked to the group assignment page done
Documented your process. done
Explained the UI that you made and how you did it. done
Explained how your application communicates with your embedded board. done
Included original source code (or a screenshot of the app code if that's not possible). done
Included a ‘hero shot’ of your application running & communicating with your board. done

HERO SHOT

Group Assignment

Here is the Link to our group Assignmnent.

Key Take aways:

  1. There are several languages and application we could use to make the interface but it would take time to explore them all for now.
  2. We explored wireless communiation for this week with the interface we made.

Indvidual Assignment

For this weeks assignment I decided to use processor as our Rico gave us a turorial class on using tutorial found in intresting.

“Processing is a flexible software sketchbook and a language for learning how to code. Since 2001, Processing has promoted software literacy within the visual arts and visual literacy within technology. There are tens of thousands of students, artists, designers, researchers, and hobbyists who use Processing for learning and prototyping.”

Processor

I download the processor for windows from this Link and installed the Processor IDE.

Using Processor for this weeks assignment, I want to control the output on my Board programmed using Arduino IDE using the processor Interface throught serial communication.

First Try

I refered a youtube tutorial where Arduino IDE and Processor was used. I tried his code where the guy creates a blank space and controlles the LED output with mouse click.

In the code below I created a blank field with black background, which communicates with COM port 8 where my board in connected.

alt text

After writing the code and after connecting the board and uploading the code press the play button shown below. When the LEFT mouse in clicked when on the blank field, a vlaue of 1/HIGH is send to COM8 and when RIGH mouse button in clicked on the blank field, a value of 0 is sent to COM8.

alt text

On the other side, on COM8 connected to my Board connected to LED output is listening to serial communication for 1 or 0 which trigers the LED ON and OFF respectively.

alt text

Second Try

For the second code, I was playing around with different shapes I could draw using processor. I took reference from Ricos tutorial and also Processor page Given below are the codes I used. I used few differnt shapes like circle, rectangle and triangle. Also played around colors.

Code below creates an imaginary weird animal who Farts shown by small circles when LEFT mouse is clicked. This event, send a value 1 to the serial COM port, which is COM8 where my board is connected. When I click RIGHT mouse it send 0 value and the circles also disappears.

import processing.serial.*;

//Serial myPort;
String myText=" ";

void setup(){
  size(1200, 800);
  myPort = new Serial(this, "COM8", 9600);
 // myPort.bufferUnit('\n');

}
void serialEvent (Serial myPort){
  //myText = myPort.readStringUnil('\n');
}
void draw(){
background(0,0,0);
text(myText,120,120);
myText=" ";

noStroke();
  fill(0,255,255);
  rect(400,250, 400, 400);
noStroke();
  fill(255,255,255);
  circle(400,200,400);

noStroke();
  fill(0,0,0);
  circle(350,150,100);

 noStroke();
  fill(0,0,0);
  circle(500,200,100);

 noStroke();
    triangle(120, 300, 232, 80, 344, 300);


if (mousePressed &&(mouseButton == LEFT)){

  stroke(153);
  fill(0,100,250);
  circle(800, 600, 50);

  stroke(153);
  fill(0,100,250);
  circle(900, 500, 100);

  stroke(153);
  fill(0,100,250);
  circle(1000, 300, 250);

  fill(200);
  textSize(30);
  text("pOOP!", 1000, 300);

  myPort.write('1');
}

if (mousePressed && (mouseButton == RIGHT)){
  myPort.write('0');
  }
}

alt text

For the arduino code, I modified the LED code above for a buzzer and connected buzzer in GPIO2. The buzzer will turns ON when it receives a value 1 in serial port and OFF when it receives 0.

alt text alt text

Files

Arduino Buzzer Code

Arduino LED code

Processor codes for first try

Processor code for Second try