jueves, 26 de noviembre de 2015

PROYECTO FINAL

DESCRIPCIÓN:


Tendremos un sensor PIR el cual será graficado en Processing y cada que sienta movimiento este ira aumentando, si no, se detendrá.

El movimiento será visto por medio de un LED el cual ira conectado al pin 13 de prueba que tiene el Arduino, el cual no necesita resistencia.


MATERIALES DEL LABORATORIO: 

  1. Computador (con el IDE de Arduino, y el driver adecuado instalados)
  2. Tarjeta Arduino (cualquier modelo, debe corresponder al driver instalado)
  3. Cable USB (según el conector de la tarjeta Arduino)
  4. 1 LEDs
  5. Cables macho-macho
  6. Cables hembra-hembra
  7. Sensor PIR


DIAGRAMA:



ESQUEMATICO:






PBC:








FOTOS MONTAJE:









VIDEO:  







CODIGO:


Arduino:
//____________ Laboratorio FINAL ___________//
// * Universidad Santiago de Cali
// * James Sanchez Bejarano
// * Felipe Garcia
// * Laboratorio Final: Tendremos un sensor PIR el cual será graficado en Processing
// * por medio de un LED y cuando sienta movimiento este ira aumentando, si no, se detendrá.
//


//____________ Variables ___________//

//Pines en los que se conectara el Sensor(A0), y el led(13).
 byte sensorpir = A0;
 byte led = 13;


//____________ Procesos ___________//

void setup()
{  
  
 //Se notifica que el sensor esta de entrada y la salida la da el LED.
 pinMode(sensorpir,INPUT);
 pinMode(led,OUTPUT);
 Serial.begin(9600);
}

void loop()
{
  
  //Se lee la entrada, y se le envia la variable del sensor para activarlo al movimiento.
  if(digitalRead(sensorpir) == HIGH){
    
    //Enviamos señal al Monitor para testear si funciona.
    Serial.println("Detectado movimiento por el sensor pir");

    digitalWrite(led,HIGH);
    delay(1000);
    digitalWrite(led,LOW);
    
    // Le enviamos un valor al Pin A0:
   Serial.println(analogRead(A0));
   
  }
  }
  
  
Processing:
//____________ Laboratorio Final ___________//
// * Universidad Santiago de Cali
// * James Sanchez Bejarano
// * Felipe Garcia
// * Laboratorio Final: Tendremos un sensor PIR el cual será graficado en Processing
// * por medio de un LED y cuando sienta movimiento este ira aumentando, si no, se detendrá.
//
//____________ Variables ___________//

//Comunicacion con Arduino
 import processing.serial.*;

//Se crea las variables para manejar el puerto y la posicion del grafico
  Serial myPort;     
  int xPos = 1;  


int xlogo=400;//Posición X de la imagen
int ylogo=50;//Posición Y de la imagen

//Variables para mover el logo
int rquad=40; //Radio del quadrado
int xquad=200;  //Posición X de rect
int yquad=200;  //Posición Y de rect
boolean overRect = false; //Estado del mouse si está encima de rect o no


//____________ Procesos ___________//


  void setup () {
    
  // Tamaño de la ventana
  size(800, 600);

  // Lista de puertos seriales disponibles, para verlos usar Serial.printArray()
  println(Serial.list());

  // Si sabes que el puerto es el primero, el Arduino sera el Serial.list()[0]. Si no otro.
  myPort = new Serial(this, Serial.list()[0], 9600);

  // Para no generar un serialEvent() :
  myPort.bufferUntil('\n');

  // El color de fondo
  background(0);
  }


  void draw () {

  //Asignatura de trabajo final
   text("TRABAJO FINAL: Programacion en embebidos",250,110);
    
 //Visualizamos los nombres con un texto
   text("James Sanchez",300,140);
   text("Felipe Garcia",300,155);

//Definicion
   text("GRAFICO PARA SENSOR DE MOVIMIENTO",250,190);
   

  //Ponemos la imagen de nuestro logo
  imageMode(CENTER);//Esta función hace que las coordenadas de la imagne sean el centro de esta y no la esquina izquierda arriba
  PImage imagen=loadImage("USC.png");
  image(imagen,xlogo,ylogo,200,100);
  
//Para mover el logo
if(mouseX > xquad-rquad && mouseX < xquad+rquad &&  //Si el mouse se encuentra dentro de rect
     mouseY > yquad-rquad && mouseY < yquad+rquad)
     {
       overRect=true;  //Variable que demuestra que el mouse esta dentro de rect
       stroke(255,0,0);  //Contorno de rect rojo
     }
   else
   {
     overRect=false;  //Si el mouse no está dentro de rect, la variable pasa a ser falsa
     stroke(0,0,0);  //Contorno de rect negro
   }
   

}

// Para hacer y mover el grafico
  void serialEvent (Serial myPort) {
  // get the ASCII string:
  String inString = myPort.readStringUntil('\n');

  if (inString != null) {
  // trim off any whitespace:
  inString = trim(inString);
  // convert to an int and map to the screen height:
  float inByte = float(inString);
  inByte = map(inByte, 0, 1023, 0, height);

  // draw the line:
  stroke(127,34,255);
  line(xPos, height, xPos, height - inByte);

  // at the edge of the screen, go back to the beginning:
  if (xPos >= width) {
  xPos = 0;
  background(0);
  }
  else {
  // increment the horizontal position:
  xPos++;
  }
  }
  }
  
  
  //Metodo para mover el logo
void keyPressed() //Cuando se pulsa una tecla
{
  if(key=='w'||key=='W')
  {
      ylogo--; //El logo se deplaza hacia arriba
  }
  else if(key=='s'||key=='S')
  {
        ylogo++; //El logo se deplaza hacia abajo
  }
  else if(key=='a'||key=='A')
  {
        xlogo--; //El logo se desplaza hacia la izquierda
  }
  else if(key=='d'||key=='D')
  {
        xlogo++; //El logo se desplaca hacia la derecha
  }
  //Pulsar la tecla E para salir del programa
  if(key=='e' || key=='E')
  {
    exit();//Salimos del programa
  }
  }
  




miércoles, 18 de noviembre de 2015

LABORATORIO # 11

DESCRIPCIÓN :

Enviar desde un interfaz en processing un mensaje a una matriz LED 8x8( Desplazándose de izquierda a derecha) a través de IC MAX7219.



MATERIALES:

- Protoboard
- Arduino UNO
- Cable UTP
- Matriz Led 8x8
- Cables



DIAGRAMAS:




ESQUEMÁTICO:





FOTOS MONTAJE:







VIDEO:





CODIGO:

#include "LedControl.h"

String texto="";
/*
 Now we need a LedControl to work with.
 ***** These pin numbers will probably not work with your hardware *****
 pin 12 is connected to the DataIn
 pin 11 is connected to the CLK
 pin 10 is connected to LOAD
 We have only a single MAX72XX.
 */
LedControl lc=LedControl(12,11,10,1);


/* we always wait a bit between updates of the display */
unsigned long delaytime=100;

void setup() {
  Serial.begin(9600);
  /*
   The MAX72XX is in power-saving mode on startup,
   we have to do a wakeup call
   */
  lc.shutdown(0,false);
  /* Set the brightness to a medium values */
  lc.setIntensity(0,8);
  /* and clear the display */
  lc.clearDisplay(0);
}
char abcMAY[36]={'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z','1','2', '3', '4', '5', '6', '7', '8', '9', '0'};
char abcMIN[36]={'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z','1','2', '3', '4', '5', '6', '7', '8', '9', '0'};
byte letras[36][5]= {

  {B11111110,B00010001,B00010001,B00010001,B11111110},//A
  {0xFF, 0x89, 0x89, 0x89, 0x76},//B
  {B01111110,B10000001,B10000001,B10000001,B01000110},//C
  {0xff, 0x81, 0x81, 0x81, 0x7e},//D
  {0x7e, 0x89, 0x89, 0x89, 0x89},//E
  {0xff, 0x09, 0x09, 0x09, 0x01},//F
  {0x7e, 0x89, 0x89, 0x89, 0xf2},//G
  {0xFF, 0x18, 0x18, 0x18,0xff},//H
  {B00000000,B10000100,B11111101,B10000000,B00000000},//I
  {0x71, 0x81, 0x7f, 0x01, 0x01},//J
  {0xff, 0x10, 0x2c, 0x42, 0x81},//K
  {0x7f, 0xc0, 0x80,0x80, 0x80},//L
  {0xff, 0x06, 0x0c, 0x06, 0xff},//M
  {B11111111,B00000100,B00001000,B00010000,B11111111}, //N
  {B01111110,B10000001,B10000001,B10000001,B01111110},//O
  {0xff, 0x09, 0x09, 0x09, 0x06},//P
  {0xbe, 0x41,0xA1, 0x81, 0x7e},//Q
  {B11111111,B00010001,B00110001,B01010001,B10001110},//R
  {0x86, 0x89, 0x89, 0x89, 0x71},//S
  {0x01, 0x01, 0xff, 0x01, 0x01},//T
  {B01111111,B11000000,B11000000,B11000000,B01111111},//U
  {0x3f, 0x40, 0x80, 0x40, 0x3f},//V
  {0x7f, 0x80, 0x70, 0x80, 0x7f},//W
  {0xe3, 0x14, 0x08, 0x14, 0xe3},//X
  {0x03, 0x04, 0xf8, 0x04, 0x03},//Y
  {0xe1, 0x91, 0x89, 0x85, 0x83 }//Z

  ,{0x00, 0x82, 0xff, 0x80,0x00},//1
  {0xc2, 0xa1, 0x91, 0x89, 0x86},//2
  {0x81,0x81,0x85,0x8b,0x71},//3
  {0x18,0x14, 0x12, 0xff, 0x00},//4
  {0x8f, 0x89, 0x89, 0x89, 0x71},//5
  {0x7c, 0x8a, 0x89, 0x89, 0x70},//6
  {0x01, 0xf1, 0x09,0x05, 0x03},//7
  {0x76, 0x89, 0x89, 0x89, 0x76},//8
  {0x06, 0x89, 0x89, 0x89, 0x7e },//9
  {B01111110,B11100001,B10011001,B10000111,B01111110},//O
};

/*

 This method will display the characters for the
 word "Arduino" one after the other on the matrix.
 (you need at least 5x7 leds to see the whole chars)
 */
void writeArduinoOnMatrix(String mensajea) {
  /* here is the data for the characters */


 for(int j=0;j<mensajea.length();j++){
   for(int k=0;k<36;k++){
 if(mensajea.charAt(j)==abcMAY[k] || mensajea.charAt(j)==abcMIN[k]){
 palabras(letras[k]);
 }
 }
 }

}
void palabras(byte listd[]){
  for(int j=7;j>-4;j--){
 
  for(int i=4; i> -1; i--){
  lc.setRow(0,j+i,listd[i]);
  }
  delay(delaytime);
  for(int o=0; o<8 ; o++){
  lc.setRow(0,o,0);
  }
  }
}

void loop() {
  writeArduinoOnMatrix(texto);

}

void serialEvent(){
while(Serial.available()){
texto= Serial.readString();
}
}







LABORATORIO # 10

DESCRIPCIÓN DEL LABORATORIO:

En este laboratorio controlaremos desde el arduino, una matriz LED 8x8 a través de un IC MAX7219, mostrando un numero de 0 a 9 según la posición que le demos al potenciómetro.


MATERIALES:

- Protoboard
- Arduino Uno
- Potenciómetro
- Matriz Led 8*8
- Cables


DIAGRAMAS;






ESQUEMÁTICO:




FOTOS MONTAJE:






                                      




VIDEO:







CÓDIGO:


#include "LedControl.h"

int DataPin = 9;       //pin 9 conectado a DataIn
int ClockPin = 10;     //pin 10 conectado a CLK
int LatchPIN = 8;      //pin 8 conectado a LOAD/CS
int POT1 = A0;         //A0 Potenciometro

LedControl lc=LedControl(DataPin,ClockPin,LatchPIN,1);

//retardo entre envios de datos
unsigned long delaytime=100;
 //Mostrará los caracteres para la numeración del 0 al 9 ,
 //incluyendo el espacio

byte cero[5]={ B00111110, B01000001, B01000001, B00111110, B00000000}; //
byte uno[5]={ B01000010, B01111111, B01000000, B00000000, B00000000}; //
byte dos[5]={ B01100010, B01010001, B01001001, B01000110, B00000000}; //
byte tres[5]={ B00100010, B01000001, B01001001, B00110110, B00000000}; //
byte cuatro[5]={ B00011000, B00010100, B00010010, B01111111, B00000000}; //
byte cinco[5]={ B00100111, B01000101, B01000101, B00111001, B00000000}; //
byte seis[5]={ B00111110, B01001001, B01001001, B00110000, B00000000}; //
byte siete[5]={ B01100001, B00010001, B00001001, B00000111, B00000000}; //
byte ocho[5]={ B00110110, B01001001, B01001001, B00110110, B00000000}; //
byte nueve[5]={ B00000110, B01001001, B01001001, B00111110, B00000000}; //
byte espacio[5]={ B00000000, B00000000, B00000000, B00000000, B00000000}; //
// Permite ejecutar el byte requerido
byte kar[100] = {
  B00000000, B00000000, B00000000, B00000000, B00000000,
  B00111110, B01000001, B01000001, B00111110, B00000000,
  B00000000, B00000000, B00000000, B00000000, B00000000,
  B01000010, B01111111, B01000000, B00000000, B00000000,
  B00000000, B00000000, B00000000, B00000000, B00000000,
  B01100010, B01010001, B01001001, B01000110, B00000000,
  B00000000, B00000000, B00000000, B00000000, B00000000,
  B00100010, B01000001, B01001001, B00110110, B00000000,
  B00000000, B00000000, B00000000, B00000000, B00000000,
  B00011000, B00010100, B00010010, B01111111, B00000000,
  B00000000, B00000000, B00000000, B00000000, B00000000,
  B00100111, B01000101, B01000101, B00111001, B00000000,
  B00000000, B00000000, B00000000, B00000000, B00000000,
  B00111110, B01001001, B01001001, B00110000, B00000000,
  B00000000, B00000000, B00000000, B00000000, B00000000,
  B01100001, B00010001, B00001001, B00000111, B00000000,
  B00000000, B00000000, B00000000, B00000000, B00000000,
  B00110110, B01001001, B01001001, B00110110, B00000000,
  B00000000, B00000000, B00000000, B00000000, B00000000,
  B00000110, B01001001, B01001001, B00111110, B00000000};

void setup() {
  /* el MAX7219 esta en modo Power-saving cuando se
   inicia, se debe sacar de ese estado*/
  lc.shutdown(0,false);  
  lc.setIntensity(0,4);    // configurar brillo a nivel medio
  lc.clearDisplay(0);      // limpiar pantalla
//Establece el pin análogo POT1 como salida
 pinMode(POT1,INPUT);

 
}
void loop() //Función principal.
// Dependiendo de cada dígito, se envía a la función display
// los estados (0 y 1) a cada uno de los segmentos.
{
  int t1=analogRead(POT1);
  int pos=map(t1,0,1023,0,94);
  lc.setRow(0,0,0);

  // for (int j=0;j<50;j++){
 // Muestra el retraso que debe tener cada caracter
    lc.setRow(0,0,kar[pos]);
    lc.setRow(0,1,kar[pos+1]);
    lc.setRow(0,2,kar[pos+2]);
    lc.setRow(0,3,kar[pos+3]);
    lc.setRow(0,4,kar[pos+4]);
    lc.setRow(0,5,kar[pos+5]);
    lc.setRow(0,6,kar[pos+6]);
    lc.setRow(0,7,kar[pos+7]);

    delay(200);//El tiempo de espera en milisegundos

  /* digitalWrite(LatchPIN, LOW);
  shiftOut(DataPin, ClockPin, MSBFIRST, kar[pos]);
  digitalWrite(LatchPIN, HIGH);
   */
}








LABORATORIO # 9

DESCRIPCIÓN DEL LABORATORIO:

En este laboratorio controlaremos desde el arduino una matriz Led 8*8 a través de un IC MAX7219, para mostrar un número del 0 al 9, dependiendo de la posición del potenciómetro.


MATERIALES:

- 1 Módulo 8 Leds RGB
- Arduino
- Protoboard
- Cables


DIAGRAMAS:

En fritzing:




ESQUEMÁTICO:







FOTOS MONTAJE:










VIDEO:

CODIGO:

ARDUINO

#define TOTAL 8
#define MAX 8

//Declaracion de pines y de arreglos
// Conectamos el LED a los pines,9,10,11 que es PWM

// salida pwm  para el color rojo
int pin_r = 9;
// salida pwm  para el color verde
int pin_g = 10;
// salida pwm  para el color rojo
int pin_b = 11;

// Indica los pines en el que debe estar conectado el modulo

int led[TOTAL] = {2, 3, 4, 5, 6, 7, 8, 12};

// Se inicializan los datos de cada variable de color

int R[TOTAL]={0,0,0,0,0,0,0,0};
int G[TOTAL]={0,0,0,0,0,0,0,0};
int B[TOTAL]={0,0,0,0,0,0,0,0};

// Variables de cada componenten Inicializadas

int pos = 0;
int color = 0;
int estado = 0;
String str = "";

 /********** Configuracion **********/
void setup() {

 //comunicacion serial sera a 9600 baudios y pines inicializados con sus estados
 
  Serial.begin(9600);
  for (int i = 0; i < TOTAL; i++) {
  pinMode(led[i], OUTPUT);
  digitalWrite(led[i], HIGH);
  }
 
  // se configuran las salidas PWM usadas
    // pin de salida, color rojo

  pinMode(pin_r, OUTPUT);
  digitalWrite(pin_r, HIGH);
 
  // pin de salida, color verde
  pinMode(pin_g, OUTPUT);
  digitalWrite(pin_g, HIGH);
 
  // pin de salida, color azul
  pinMode(pin_b, OUTPUT);
  digitalWrite(pin_b, HIGH);
}
  /********** Ciclo Principal **********/
 // Solo se ejecuta una vez, al iniciar o resetear el Arduino
// Ciclo infinito de ejecucion

void loop() {
  leerSerial();
  for (int i=0; i<TOTAL; i++) {
    encender(led[i], R[i], G[i], B[i]);
  }
}
    // aqui se condiciona si el valor enviado  para
    // la intensidad del pin R, G o B del modulo
   
//metodo necesario para leer la informacion serial

void leerSerial() {
  if (Serial.available() > 0) {
    str = Serial.readString();
    pos = int(str[1] - '0');
    estado = int(str[2] - '0');
    switch (str[0]) {
      case 'r': R[pos] = estado; break;;
      case 'g': G[pos] = estado; break;;
      case 'b': B[pos] = estado; break;; }}}
     
//metodo para encender cada led deacuardo al pin usado
void encender (int pin_led, int r, int g, int b)
{
  digitalWrite(pin_led, LOW);
  digitalWrite(pin_r, r == 0 ? HIGH : LOW);
  digitalWrite(pin_g, g == 0 ? HIGH : LOW);
  digitalWrite(pin_b, b == 0 ? HIGH : LOW);
 
  delay(2);
 
  digitalWrite(pin_led, HIGH);
  digitalWrite(pin_r, HIGH);
  digitalWrite(pin_g, HIGH);
  digitalWrite(pin_b, HIGH);
}



PROCESSING:


import controlP5.*;
import processing.serial.*;

// Se Definen las variables necesarias

ControlP5 cp5;
Serial serial;

// define las variables del texto, tipo Textlabel

Textlabel texto1, texto2;
Textlabel texto5, texto6;

//****** Objetos ********//

// Areglos para las variables de cada color: rojo, verde, azul.

int[] r = new int[] {0, 0, 0, 0, 0, 0, 0, 0};
int[] g= new int[] {0, 0, 0, 0, 0, 0, 0, 0};
int[] b= new int[] {0, 0, 0, 0, 0, 0, 0, 0};

//**** variables*****//

int colorDeFondo = color (200,100,100);

//***********configuracion*********************//

// Solo se ejecuta una vez, al iniciar el Sketch//

void setup() {

  size(600, 300); // tamaño de la ventana

   // crear el objeto ControlP5
  cp5 = new ControlP5(this);
 
  // crear un botón para encender/apagar cada LED
  // para el color rojo
 
  for (int i=0; i<r.length; i++)
    cp5.addToggle("r"+i, 35+i*70, 60, 50, 40);
 
  // para el color verde

  for (int j=0; j<g.length; j++)
    cp5.addToggle("g"+j, 35+j*70, 130, 50, 40);
 
   // para el color azul

  for (int k=0; k<b.length; k++)
    cp5.addToggle("b"+k, 35+k*70, 200, 50, 40);
 
  // Creamos el objeto del puerto Serial
   serial = new Serial(this, Serial.list()[0], 9600);
 
   // Se crea el texto principal
 
texto1 = cp5.addTextlabel("label")


                    .setText("CONTROLES DE ENCENDIDO Y APAGADO")
                    .setPosition(100,10)
                    .setColorValue(0xfffffFFF)
                    .setFont(createFont("Arial",20))
                    ;

// crea texto indicativo

texto2 = cp5.addTextlabel("label1")

                    .setText("COLOR ROJO VERDE Y AZUL")
                    .setPosition(180,30)
                    .setColorValue(0xffffffFF)
                    .setFont(createFont("Comic Sans MS",15))
                    ;            

}

// se dibujar cada frame y se asigna el color de fondo

void draw()
{
 {background(colorDeFondo);}
}

// actua cuando ocurra un evento con los botones

void controlEvent(ControlEvent theEvent)
{
  // guardar el nombre y valor del evento
  String nombre = theEvent.getController().getName();
  int valor = int(theEvent.getController().getValue());

  println("evento: " + nombre + " / valor: "+valor);
  //serial.write(nombre+valor);
  println(nombre+valor);
  serial.write(nombre+valor);
 

}


jueves, 24 de septiembre de 2015

LABORATORIO #7

DESCRIPCIÓN DEL LABORATORIO:  Controlar un LED RGB desde el Arduino, vía PWM con una interfaz gráfica en Processing/ControlP5 para controlar el valor de cada color.





MATERIALES:



- Arduino
- Protoboard
- Led RGB
- Cable UTP
- 3 Resistencias
- Cables


DIAGRAMAS:


En Protoboard



ESQUEMATICO:




FOTOS DEL MONTAJE:










VIDEO:








CODIGO ARDUINO:



Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1.  #define MAXLED 3
  2. int led[MAXLED] = {9,10,11};
  3. int valor = 0;
  4. int i = 0;
  5. void setup()
  6. {
  7.   Serial.begin(9600);
  8.   for(int i = 0; i < MAXLED ; i++)
  9.   {
  10.     pinMode(led[i], OUTPUT);
  11.   }
  12. }
  13. void loop()
  14. {
  15.   if(Serial.available() > 0)
  16.   {
  17.     valor = Serial.read();
  18.     if(valor == 'R')
  19.       i = 0;
  20.     if(valor == 'G')
  21.       i = 1;
  22.     if(valor == 'B')
  23.       i = 2;
  24.     valor = Serial.parseInt();
  25.     analogWrite(led[i], valor);
  26. }



CODIGO PROCESSING:


Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1.  import controlP5.*;        
  2. import processing.serial.*;  
  3. ControlP5 cp5;                
  4. Knob rojo, verde, azul;        
  5. Textlabel texto1, texto2, texto3, texto4, texto5, texto6;
  6. Serial serial;                
  7. void setup()
  8. {
  9. serial = new Serial(this, Serial.list()[0],9600);  
  10. String puerto = Serial.list()[0];                  
  11. size(620,400);                      
  12. cp5 = new ControlP5(this);        
  13. rojo = cp5.addKnob("R",0,255,0,70,120,100);
  14. rojo.setColor(newCColor(0xFFff0000,0xFF9f9f00,0xFF5f0000,0xFFFFFFFF,0xFFFFFFFF));
  15. verde = cp5.addKnob("G",0,255,0,260,120,100);
  16. verde.setColor(newCColor(0xFF00FF00,0xFF9f9f00,0xFF005F00,0xFFFFFFFF,0xFFFFFFFF));
  17. azul = cp5.addKnob("B",0,255,0,450,120,100);
  18. azul.setColor(newCColor(0xFF0000ff,0xFF9f9f00,0xFF00005f,0xFFFFFFFF,0xFFFFFFFF));
  19. texto1 = cp5.addTextlabel("label")
  20.                     .setText("CONTROL DE LED RGB")
  21.                     .setPosition(25,48)
  22.                     .setColorValue(0xffff0000)
  23.                     .setFont(createFont("Ravie",30))
  24.                     ;
  25.                    
  26. texto2 = cp5.addTextlabel("label1")
  27.                     .setText("AZUL")
  28.                     .setPosition(475,235)
  29.                     .setColorValue(0xffff0000)
  30.                     .setFont(createFont("Comic Sans MS",15))
  31.                     ;              
  32.    
  33. texto3 = cp5.addTextlabel("label2")
  34.                     .setText("VERDE")
  35.                     .setPosition(280,235)
  36.                     .setColorValue(0xffff0000)
  37.                     .setFont(createFont("Comic Sans MS",15))
  38.                     ;
  39.                    
  40. texto4 = cp5.addTextlabel("label3")
  41.                     .setText("ROJO")
  42.                     .setPosition(95,235)
  43.                     .setColorValue(0xffff0000)
  44.                     .setFont(createFont("Comic Sans MS",15))
  45.                     ;              
  46. texto4 = new Textlabel(cp5,"Estudiante: Juberth Andres Renteria",40,280,600,200);  
  47. texto4.setFont(createFont("MV Boli",15));
  48. texto5 = new Textlabel(cp5,"Ingenieria Electronica",40,295,600,200);  
  49. texto5.setFont(createFont("MV Boli",15));
  50. texto6 = new Textlabel(cp5,"Noveno semestre",40,310,600,200);  
  51. texto6.setFont(createFont("MV Boli",15));
  52. }
  53. void draw()
  54. {
  55. background(100,70,20);  
  56.  texto4.draw(this);  
  57.  texto5.draw(this);
  58.  texto6.draw(this);
  59. }
  60. void controlEvent (ControlEvent evento)
  61. {
  62. String nombre = evento.getController().getName();  
  63. int valor = int(evento.getController().getValue());  
  64. serial.write(nombre + ":" + valor);  
  65. println(nombre + ":" + valor);  
  66. }