Week 12: Interface and Application Programming

Individual Assigment
* write an application that interfaces a user with an input and/or output device that you made

Group Assigment
* compare as many tool options as possible

Google drive with all files

Invidual Assignment


Intoduction


This week's tast is to make a GUI for our circut boards to show data from input board for example. I was told that processing is quite nice to use as a 1st app. Learning the Processing I started from watching a tutorial from Mr.Shiffman on Youtube.

Begining

I decided to make an arduino with DHT11 digital sensor , the same as in Week 09: Input Devices, that will measure temperature and humidity in a room.

Processing

Ok so here we go!

As said before I started to learn Processing from very helpful man Mr. Shiffman on his YouTube Channel
After few hours of learning processing I came up with simple procjet that shows a change of reading from the sensor.

End Result


Code for Arudino:
	#include "DHT.h" //Including the sensor library
#define DHT11_PIN 2 // defining the physical sensor - telling the board on which PIN the sensor data in supplied
DHT dht; // declaration needed for DHT library

void setup() //setup void in which we state things that we want to declare once for whole code operation like pins etc.
{
  Serial.begin(9600); // declaration of badurate need to communicate with board on serial monitor
  dht.setup(DHT11_PIN); // declaration of type of the sensor applied for library purpose
}

void loop() // loop void is a section that is repeated continuously
{
  int temp = dht.getTemperature(); // using command supplied by library to read value of temperature and signing it into a int valuable
  Serial.print(temp); //printing the value on serial monitor
  Serial.println("*C"); // adding information about the value
  delay(500); //delay between next readout
}

Code for Processing:

		import processing.serial.*;

Serial port;  // Create object from Serial class
float val;      // Data received from the serial port

void setup() {
  size(200, 200);
  noStroke();
  frameRate(10);
  port = new Serial(this,"COM4", 9600);
}

void draw(){

  if (port.available() > 0){
    val = port.read();
    fill(255);
    rect(75, 25, 50, 150);
    fill(0);
    rect(75, 25, 50, val);
   print(val);
  }
}
End result:

Group Assignment


Group Assigment posted on Maciek's Page: Maciej Naskręt Week 12 Group Assigment
Go back to front page Go back to Week 11 Go to Week 13