Monthly Archives: March 2014

Fancy_Project#3B

Coding for my assignment 3B

//need to be able to set up a frame rate for the screen as well as a size.
void setup() {
size(400, 400);
frameRate(4);
smooth();

}
//names assigned to each individual item. you need to be able to call upon.
int pos = 0;
int saveNum=0;

void draw() {
exportFrame();

//background color
background(255);
// if any button is pressed it will result in the screen going completely black in color while if not pressed
screen will be white and display objects.
if(keyPressed == true) {
background(0);
}
//screen will display white.
else {
background(255);

// calling upon the rectangle where it is located 90, 180 somewhat middle of the screen.
pos++;
rect(pos, 90, pos, 180);
fill(0);
if (pos > width)
pos = 0;

//the ellipse will move based upon where the mouse X AND Y are located watch as it follows on the screen.
ellipse(mouseX, mouseY, 60, 60);

 
println(“mouseX = ” + mouseX, “mouseY = ” + mouseY);
//this will make the
fill( random(255), random(255), random(255), random(255));
}
}

 

//pressing s as either small letter or capital letter will allow you to save the image in the folder that the code is saved to.
void exportFrame() {
if(keyPressed){
if(key == ‘s’ || key == ‘S’) {
save(“masterpiece” + saveNum + “.png”);
saveNum++;
}
}
}

20140326-013946.jpg

20140326-013959.jpg

20140326-014007.jpg

20140326-014052.jpg

20140326-014218.jpg

Reading response March 17th

Does interactivity happen to surpress our creativity or merely enhance the possibilities to go above and beyond?

Do you have to physically interact with something in order to enjoy it completely, or can one just watch and get the same kind of entertainment?

Project #3A Reconstruction of painting

Screen Shot 2014-03-17 at 12.11.51 AMScreen Shot 2014-03-17 at 12.28.25 AM

Final copy of reconstruction.

The coding used to create.

//size of the rectangle
size(620,570);
//change background to black
background(0);
noStroke();
fill(255,242,188);
rect(0,0,175,175);

//red rectangle
fill(150,0,0);
rect(190,0,540,397);

//second from the top yellow rectangle
fill(255,242,188);
rect(0,200,175,195);
//
//navy blue rectangle
fill(4,33,89);
rect(0,410,175,198);

//white block bottom middle
fill(255,242,188);
rect(190,410,360,397);

//right white far right
fill(255,242,188);
rect(560,410,500,80);

//orange bottom block
fill(222,158,11);
rect(560,500,500,70);

Project #2: hybrid interaction.

20140304-142410.jpg20140310-105835.jpg20140310-105849.jpg

20140310-105903.jpg20140310-105927.jpg

In the images above you will see the construction of the ferris wheel as well as the main 2 sensors on the breadboard.

Coding for my project for all 3 sensors

#include <Servo.h>
Servo myServo;

int const potPin = A0;
int potVal;
int angle;
const int switchPin = 2;
const int motorPin = 9;
int switchState;
int lastswitchState = LOW;
int onOff = LOW;

//LEDsensor lighting coding in which changes the colors of the main LED light.

const int greenLEDPin = 12;
const int redLEDPin = 11;
const int blueLEDPin = 10;

const int  redSensorPin = A1;
const int  greenSensorPin = A2;
const int  blueSensorPin = A3;

int redValue = 0;
int greenValue = 0;
int blueValue = 0;

int redSensorValue = 0;
int greenSensorValue = 0;
int blueSensorValue = 0;

void setup() {
myServo.attach(8);

Serial.begin(9600);

//motor setup
pinMode(motorPin, OUTPUT);
pinMode(switchPin, INPUT);

//LED setup
Serial.begin(9600);

pinMode(greenLEDPin, OUTPUT);
pinMode(redLEDPin, OUTPUT);
pinMode(blueLEDPin, OUTPUT);
}
// Make sure the object and sensor does not loop.
void loop() {
potVal = analogRead(potPin);
Serial.print(“potVal: “);
Serial.print(potVal);

angle = map(potVal, 0, 1023, 0, 179);
Serial.print(“, angle: “);
Serial.print(angle);

myServo.write(angle);
delay(15);

switchState = digitalRead(switchPin);

redSensorValue = analogRead(redSensorPin);
delay(5);
greenSensorValue = analogRead(greenSensorPin);
delay(5);
blueSensorValue = analogRead(blueSensorPin);

Serial.print(“Raw Sensor Value \t Red: “);
Serial.print(redSensorValue);
Serial.print(“\t Green: “);
Serial.print(greenSensorValue);
Serial.print(“\t Blue: “);
Serial.print(blueSensorValue);

redValue = redSensorValue/4;
greenValue = greenSensorValue/4;
blueValue = blueSensorValue/4;

Serial.print(“mapped Sensor Value \t Red: “);
Serial.print(redValue);
Serial.print(“\t Green: “);
Serial.print(greenValue);
Serial.print(“\t Blue: “);
Serial.print(blueValue);

analogWrite(redLEDPin, redValue);
analogWrite(greenLEDPin, greenValue);
analogWrite(blueLEDPin, blueValue);

//this is for the motor code ON/OFF

if (switchState == HIGH && lastswitchState == LOW) {
if(onOff == LOW) {
onOff = HIGH;
}
else if(onOff == HIGH) {
onOff = LOW;
}
lastswitchState == HIGH;
if (switchState == LOW) {
lastswitchState = LOW;
}
}

digitalWrite(motorPin, onOff);
}