martes, 5 de mayo de 2015

Code and video. Red Balloon interface.

This code takes an input from a source and makes the balloon in the display grow larger until it explodes.

float bs = 0; // balloon size
int cellsize = 2; // Dimensions of each cell in the grid
int columns, rows;
Confetti[] confettis = new Confetti[1000];
int state = 0;
boolean x = false;
private color col;

class Confetti {
 private float rotY;
 private float rotZ;
 private float radius;
 private float tempRadius;
 private color col;
 private float finalZ;
 private float tempZ = 0;

 Confetti() {
 rotY = random(TWO_PI);
 rotZ = random(-PI, PI);
 radius = pow(random(8000000), .3333);
 tempRadius = 0;
 col = color(random(100),100,100);
 finalZ = random(-1000, 1000);
 }

 void run() {
 update();
 display();
 }

 void update() {
 if(state == 0) {
 tempRadius = 0;
 tempZ = 0;
 }
 if(state > 0) {
 if(tempRadius< radius-0.1) {
 tempRadius += ((radius-tempRadius)/10);
 }
 }
 }

 void display() {
 pushMatrix();

 if(state == 2) {
 translate(0,tempZ,0);
 }
 rotateY(rotY);
 rotateZ(rotZ);
 translate(tempRadius,0,0);

 rotateY(HALF_PI);
 rotateX(tempRadius/10f);
 rotateY(tempRadius/10f);
 rotateZ(tempRadius/10f);
 scale(0.1+tempRadius/radius);

 fill(col);
 rect(-5,-5,10,10);
 popMatrix();
 }
}

void setup() {
 colorMode(HSB, 100);
 size(600,690, P3D);
 background(0);
 noStroke();
 for(int i = 0; i < confettis.length; i++) {
 confettis[i] = new Confetti();
 }
}

void draw() {
 ambientLight(100,0,100);
 colorMode(HSB, 100);
 background(0);
 ambientLight(100,0,100);
 if(x){
 state = 1;
 }
 else{
 fill(100,100,100);
 triangleShape();
 ellipse(width/2, (300)-15, bs, bs*1.2);
 arc(width/2, 280, bs, (150)+(1.5*bs), 0,PI); // 180 degrees
 }
 translate(width/2, height/2, 100);
 rotateZ(1.4);
 rotateX(.7f);
 for(int i = 0; i < confettis.length; i++) {
 confettis[i].run();
 }

 if (mousePressed) {
 bs += 1; // change value for different grow rates
 }else if(bs >0){
 bs -= 2;
 }
}

void triangleShape(){
 if(bs<300){
 if(bs<20 && bs >=0){
 fill(0,0,0);
 }
 }else{
 x = true;
 }
 triangle(width/2,300+bs/(4*PI),290,310+bs,310,310+bs);




LEDS for Arduino code


const int photoresistor = A0;
const int ledr = 5;

int value;

void setup() {
  // put your setup code here, to run once:
  pinMode(ledr, OUTPUT);
  Serial.begin(9600);//print values
}

void loop() {
  // put your main code here, to run repeatedly:
  value = analogRead(photoresistor);
  if(value > 200){
    digitalWrite(ledr,LOW);
  }
  else{
    digitalWrite(ledr,HIGH);
  }
  Serial.print("Value: ");
  Serial.println(value);
  delay(1000);
}


Red Ballon animation code for processing

float bs = 0; // balloon size

int cellsize = 2; // Dimensions of each cell in the grid
int columns, rows;

void setup() {
 size(600,690);
 background(0);
}

void draw() {
 background(0);
 triangleShape();
 fill(255,0,0);
 stroke(255,0,0,0);
 ellipse(width/2, (300)-15, bs, bs*1.2);
 arc(width/2, 280, bs, (150)+(1.5*bs), 0,PI); // 180 degrees


 if (mousePressed) {
 bs += 1; // change value for different grow rates
 }else if(bs >0){
 bs -= 2;
 }
}

void triangleShape(){

 if(bs<300){
 if(bs<20 && bs >=0){
 fill(0,0,0);
 stroke(0,0,0,100);
 }
 else{
 fill(255,0,0);
 stroke(255,0,0,0);
 }
 }else{
 print("HELLOOOOO");
 }

 triangle(width/2,300+bs/(4*PI),290,310+bs,310,310+bs);

}

The idea.

To solve

Our project is designed to help young adults and adults to perform a better motor coordination.

How to solve

Focusing his attention to a bar, where he uses  flashlight o a lightning device to activate sensors, using photoresistors. The bar detects change in the light giving  an output in numbers to reach a goal.

Device main characteristics

       Photoresistors adjusted to detect the light beam of a lantern.
       LED’s to show the progress.

Feedback


The longer the light stays in the aimed photoresistor, the more LED’s the patient is going to turn on. More LED’s turned on is translated into an improvement in the motor system of the patient.  The patient may also be given a little price like  a popsicle or a candy.



Sensor Stand

The stand is the signature of our proyect. Created with balsa. in the picture below is an early prototype of what would be the aim.
 In order to make the desing more manegable we only added one sensor in the top of the tower.
 Below a photo of the early prototype of the tower with our close friend Yisus.
 More wood.

Red Ballon. Graphic Interface.

Yesterday we worked together to create the computer interface for our project. The picture above is an early draft of what would be the basic interface.


The objective of the red balloon is the receive information from then Arduino to the pc and be the connection interaction between the user and the system.

domingo, 3 de mayo de 2015

Communication sensor with Intel Galileo gen 2.

In this part of the project we are dedicated to the Arduino could communicate with a sensor in order to capture the environmental conditions.

Horseshoe sensor detects when something is in the way of the infrared sensors. The Arduino can detect the signal and make operations depending on whether the sensor is covered or not.