Week 7
The assignment
Weekly zine
The assignment
Weekly zine
This weeks zine had a different format than normal. Neza and Mellisa came up with this 14x14 cm zine and text given with that. With this information I did some research about bases and figured it out. I made a collage in photoshop instead of on paper. Easy but fun zine to make.
A base is the number of the different digits and letters used to represent numbers. In our language we use a base of ten, zero to nine make up our entire number system. It is also possible to use different bases. Computer systems are build upon binary - a two base system, which is made out of only 1’s and 0’s. If you would like to write for example 8 in binary, it would be 1000, the first digit stands for one 8, the second one for 0 fours, 0 two’s and the last for 0 ones. As binary is made up out of two digits, these numbers will always be multipliable by two.
The week started off with a little workshop by Moritz about processing. He made us make a simple ellipse, and taught us how we can change the color and size.


For this weeks assignment we had to combine our knowledge about electronics from last week with this week. We had to connect our Arduino sensor to processing.



For this week I decided to take the sensor from last week and connect it to arduino & processing. As I have to visualise subjective data I want to focus on 'how busy is your brain', by pressing the pressure plate harder your brain gets fuller!

I started off by decided there will be around 4/5 states of 'fullness'. With this information I can start coding processing. The states that I made are seen above.
The assignment
STAGE 1 - NO PRESSURE
int forcePin = A0;
int forceReading;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}

void loop() {
// put your main code here, to run repeatedly:
forceReading = analogRead(forcePin);
Serial.print("Analog reading = ");
Serial.println(forceReading);

delay(500);

}




The code for the arduino is the same code as last weeks. I declade the pin it uses and it will read the data coming from the sensor with 'forceReading'.
STAGE 2 - LOW PRESSURE
STAGE 3 - MEDIUM PRESSURE
STAGE 3 HIGH PRESSURE
I spend a lot of time working on processing. What I did first is declare the images I'm using, making a string and making an integer that I will use in an if else statement with the given data.


in the set-up the size is given and I declare the integer dataInput to take in the information of my port (so my arduino).

Here's where it starts getting tricky. I was finished with this code and the next day it stopped working. I don't have any time to fix it, so I will evaluate what could be wrong with the code or with my sensor.
So I think the problem is that I made a complete mistake with the code. https://processing.org/reference/if.html, here it says that an if/else statement will look like this;
for (int i = 5; i < height; i += 5)

I have had Javascript classes and it all looks odly familiar but I have no clue if there should be any difference in that.
Using the other students their hotglue pages was very usefull. It was like following a little tutorial of my own classmates!

I wish I had done this week, when it was assigned to be, but I'm glad I still got to work on it and fix it.
import processing.serial.*;
Serial myPort; // Create object from Serial class
PImage img;
String val;
int dataInput;



void setup()
{
size(800, 800);
String portName = Serial.list()[1]; //change the 0 to a 1 or 2 etc. to match your port
myPort = new Serial(this, portName, 9600);
//println(dataInput);
dataInput = myPort.read();


}

void draw()
{

if ( myPort.available() > 0) {
val = myPort.readStringUntil('\n');
println(val); //print it out in the console

if (dataInput > 0) {
background(0);
img = loadImage("background1.png");
background(img);
}
if (dataInput > 5) {
background(0);
img = loadImage("background2.png");
background(img);
}
if (dataInput > 10) {
background(0);
img = loadImage("background3.png");
background(img);
}

if (dataInput > 15) {
background(0);
img = loadImage("background4.png");
background(img);
}
}


}