sábado, 13 de junio de 2015

Proyecto Final

Cada uno de los que a participado en el trabajo tenía una actividad en común y una propia.
Andrés de la Fuente Mora: Pintura y montaje.
Sergio Cortés Araujo: Obtención de los materiales y montaje.
Alvaro García Lopez: cortar piezas y montaje.
Iván carretero García: codificación y montaje.

sábado, 14 de marzo de 2015

BLINK

Lo primero que hicimos fue copiar el codigo inicial “blink” y hacer el montaje correspondiente con los leds.
Tras esto lo modificamos:
-  Para que se encendiera cuando se le diera al pulsador .
-  Para que hubiera dos leds intermitentes.
-  Para que hubiera 3 leds con un patrón. Codigo:
*/
 Blink
 Turns on an LED on for one second, then off for one second, repeatedly.
 This example code is in the public domain.
*/
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 12;
int led2 = 11;
int led3 =10;
// the setup routine runs once when you press reset:
void setup() {                
 // initialize the digital pin as an output.
 pinMode(led, OUTPUT);     
 pinMode(led2, OUTPUT);
 pinMode(led3, OUTPUT);
}

// the loop routine runs over and over again forever:

void loop() {
 digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
 delay(200);
 digitalWrite(led, LOW);   // turn the LED on (HIGH is the voltage level)
 delay(200);  
 digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
 delay(200);   
 digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
 delay(200);        
 digitalWrite(led3, HIGH);    // turn the LED off by making the voltage LOW
 delay(200);     // wait for a second             // wait for a second
 digitalWrite(led3, LOW);    // turn the LED off by making the voltage LOW
 delay(200);


digitalWrite(led3, HIGH);   // turn the LED on (HIGH is the voltage level)
 delay(200);
 digitalWrite(led3, LOW);   // turn the LED on (HIGH is the voltage level)
 delay(200);  
 digitalWrite(led2, HIGH);   // turn the LED on (HIGH is the voltage level)
 delay(200);   
 digitalWrite(led2, LOW);    // turn the LED off by making the voltage LOW
 delay(200);        
 digitalWrite(led, HIGH);    // turn the LED off by making the voltage LOW
 delay(200);     // wait for a second             // wait for a second
 digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
 delay(200);

digitalWrite(led2, HIGH);   // turn the LED on (HIGH is the voltage level)
 delay(200);
 digitalWrite(led2, LOW);   // turn the LED on (HIGH is the voltage level)
 delay(200);  
 digitalWrite(led2, HIGH);   // turn the LED on (HIGH is the voltage level)
 delay(200);   
 digitalWrite(led2, LOW);    // turn the LED off by making the voltage LOW
 delay(200);        
 digitalWrite(led3, HIGH);    // turn the LED off by making the voltage LOW
 delay(200);     // wait for a second             // wait for a second
 digitalWrite(led3, LOW);    // turn the LED off by making the voltage LOW
 delay(200);
 
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
 delay(200);
 digitalWrite(led, LOW);   // turn the LED on (HIGH is the voltage level)
 delay(200);  
 digitalWrite(led2, HIGH);   // turn the LED on (HIGH is the voltage level)
 delay(200);   
 digitalWrite(led2, LOW);    // turn the LED off by making the voltage LOW
 delay(200);        
 digitalWrite(led, HIGH);    // turn the LED off by making the voltage LOW
 delay(200);     // wait for a second             // wait for a second
 digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
 delay(200);  
   digitalWrite(led4, HIGH);    // turn the LED off by making the voltage LOW
 delay(200);     // wait for a second             // wait for a second
 
   digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
 delay(500);
 digitalWrite(led2, HIGH);   // turn the LED on (HIGH is the voltage level)
 delay(500);  
 digitalWrite(led3, HIGH);   // turn the LED on (HIGH is the voltage level)
 delay(500);         
 digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
 delay(500);     // wait for a second             // wait for a second
 digitalWrite(led2, LOW);    // turn the LED off by making the voltage LOW
 delay(500);  
   digitalWrite(led3, LOW);    // turn the LED off by making the voltage LOW
 delay(500);     // wait for a second             // wait for a second
}

-  Para que hubiera 4 leds con un patrón. Código:
*/
 Blink
 Turns on an LED on for one second, then off for one second, repeatedly.
 This example code is in the public domain.
*/
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 12;
int led2 = 11;
int led3 =10;
int led4 = 9;
// the setup routine runs once when you press reset:
void setup() {                
 // initialize the digital pin as an output.
 pinMode(led, OUTPUT);     
 pinMode(led2, OUTPUT);
 pinMode(led3, OUTPUT);
 pinMode(led4, OUTPUT);
}

// the loop routine runs over and over again forever:

void loop() {
 digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
 delay(200);
 digitalWrite(led, LOW);   // turn the LED on (HIGH is the voltage level)
 delay(200);  
 digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
 delay(200);   
 digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
 delay(200);        
 digitalWrite(led3, HIGH);    // turn the LED off by making the voltage LOW
 delay(200);     // wait for a second             // wait for a second
 digitalWrite(led3, LOW);    // turn the LED off by making the voltage LOW
 delay(200);
  digitalWrite(led4, HIGH);    // turn the LED off by making the voltage LOW
 delay(200);     // wait for a second             // wait for a second
 digitalWrite(led4, LOW);    // turn the LED off by making the voltage LOW
 delay(200);


digitalWrite(led3, HIGH);   // turn the LED on (HIGH is the voltage level)
 delay(200);
 digitalWrite(led3, LOW);   // turn the LED on (HIGH is the voltage level)
 delay(200);  
 digitalWrite(led2, HIGH);   // turn the LED on (HIGH is the voltage level)
 delay(200);   
 digitalWrite(led2, LOW);    // turn the LED off by making the voltage LOW
 delay(200);        
 digitalWrite(led, HIGH);    // turn the LED off by making the voltage LOW
 delay(200);     // wait for a second             // wait for a second
 digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
 delay(200);  
   digitalWrite(led4, HIGH);    // turn the LED off by making the voltage LOW
 delay(200);     // wait for a second             // wait for a second
 digitalWrite(led4, LOW);    // turn the LED off by making the voltage LOW
 delay(200);

digitalWrite(led2, HIGH);   // turn the LED on (HIGH is the voltage level)
 delay(200);
 digitalWrite(led2, LOW);   // turn the LED on (HIGH is the voltage level)
 delay(200);  
 digitalWrite(led2, HIGH);   // turn the LED on (HIGH is the voltage level)
 delay(200);   
 digitalWrite(led2, LOW);    // turn the LED off by making the voltage LOW
 delay(200);        
 digitalWrite(led3, HIGH);    // turn the LED off by making the voltage LOW
 delay(200);     // wait for a second             // wait for a second
 digitalWrite(led3, LOW);    // turn the LED off by making the voltage LOW
 delay(200);
   digitalWrite(led4, HIGH);    // turn the LED off by making the voltage LOW
 delay(200);     // wait for a second             // wait for a second
 digitalWrite(led4, LOW);    // turn the LED off by making the voltage LOW
 delay(200);
 
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
 delay(200);
 digitalWrite(led, LOW);   // turn the LED on (HIGH is the voltage level)
 delay(200);  
 digitalWrite(led2, HIGH);   // turn the LED on (HIGH is the voltage level)
 delay(200);   
 digitalWrite(led2, LOW);    // turn the LED off by making the voltage LOW
 delay(200);        
 digitalWrite(led, HIGH);    // turn the LED off by making the voltage LOW
 delay(200);     // wait for a second             // wait for a second
 digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
 delay(200);  
   digitalWrite(led4, HIGH);    // turn the LED off by making the voltage LOW
 delay(200);     // wait for a second             // wait for a second
 digitalWrite(led4, LOW);    // turn the LED off by making the voltage LOW
 delay(200);
 
   digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
 delay(500);
 digitalWrite(led2, HIGH);   // turn the LED on (HIGH is the voltage level)
 delay(500);  
 digitalWrite(led3, HIGH);   // turn the LED on (HIGH is the voltage level)
 delay(500);   
 digitalWrite(led4, HIGH);    // turn the LED off by making the voltage LOW
 delay(500);        
 digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
 delay(500);     // wait for a second             // wait for a second
 digitalWrite(led2, LOW);    // turn the LED off by making the voltage LOW
 delay(500);  
   digitalWrite(led3, LOW);    // turn the LED off by making the voltage LOW
 delay(500);     // wait for a second             // wait for a second
 digitalWrite(led4, LOW);    // turn the LED off by making the voltage LOW
 delay(500);

}

SPACE INTERFACE

Lo primero que hicimos fue coger el código inicial y hacer su montaje.
Tras esto lo modificamos para que se pudiera encender otro led. Código:
int switchstate = 0;


void setup(){
 // declare the LED pins as outputs
 pinMode(3,OUTPUT);
 pinMode(4,OUTPUT);
 pinMode(5,OUTPUT);
 pinMode(6,OUTPUT);


 // declare the switch pin as an input   
 pinMode(2,INPUT);
}
void loop(){


 // read the value of the switch
 // digitalRead() checks to see if there is voltage
 // on the pin or not  
 switchstate = digitalRead(2);


 // if the button is not pressed
 // turn on the green LED and off the red LEDs  
 if (switchstate == LOW) {
   digitalWrite(3, HIGH); // turn the green LED on pin 3 on
   digitalWrite(4, LOW);  // turn the red LED on pin 4 off
   digitalWrite(5, LOW);  // turn the red LED on pin 5 off
   digitalWrite(6,LOW);
 }
 // this else is part of the above if() statement.
 // if the switch is not LOW (the button is pressed)
 // turn off the green LED and blink alternatively the red LEDs
 else {
   digitalWrite(4,LOW);
   digitalWrite(6,HIGH);
   digitalWrite(5,LOW);
   // wait for a quarter second before changing the light
   delay(250);
   digitalWrite(4, LOW);  // turn the red LED on pin 4 off
   digitalWrite(5, HIGH); // turn the red LED on pin 5 on
   digitalWrite(6,LOW);
   // wait for a quarter second before changing the light
   delay(250);
   digitalWrite(4, HIGH); // turn the red LED on pin 4 on
   digitalWrite(5, LOW);  // turn the red LED on pin 5 off
   digitalWrite(6,LOW);
   // wait for a quarter second before changing the light
   delay(250);
 }

 }

jueves, 5 de febrero de 2015

serpiente roja

Lo primero que hemos hecho ha sido copiar un código base y modificando ese código hemos hecho círculos de varios colores.
int azul = 255;
int tiempo = 0;
int diametro = 50;
int rojo = 255;
int verde = 255;
void setup() {
  size(500, 500);
}
 
void draw() {
  tiempo = tiempo + 1;    
  azul = int(128 * (1 + sin(tiempo * 2 * PI / frameRate / 20)));
  rojo = int(128 * (1 + sin(tiempo * 2 * PI / frameRate / 20)));
  verde = int(128 * (1 + sin(tiempo * 2 * PI / frameRate / 20)));
  diametro = int(50 * (1 + sin( tiempo * 2 * PI / frameRate / 5))); // Modifica el diametro del circulo con el paso del tiempo
   
  noStroke();            
  fill(rojo,0,azul, 90);  // Añade un 50% de transparencia al color
  ellipse(mouseX, mouseY, diametro, diametro);
}

viernes, 23 de enero de 2015

lineas colores

www.openprocessing.org/sketch/182168
Lo primero que hemos hecho ha sido copiar un código inicial y a partir de ese lo hemos modificado para que nos sirviera para la tarea. 

código original:
Es un código muy simple,lo único que hace es una linea negra.
void setup() {
size(300,300);
}

void draw() {
line(0, 0, mouseX, mouseY);

}

-------------------------------------------------------------------------------------------------------------------------------------------------------------------
códigos modificados:
Le puse color a las lineas mediante el comando stroke:
void setup() {
size(300,300);
}

void draw() {
  stroke(mouseX,mouseY,0);
line(0, 0, mouseX, mouseY);

}


-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Y luego puse que se hicieran dos lineas, cada una desde una esquina.
void setup() {
size(300,300);
}
void draw() {
  stroke(mouseX,mouseY,0);
line(0, 0, mouseX, mouseY);
stroke(0,mouseY,mouseX);
line(255,0,mouseX,mouseY);
}