Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import controlP5.*;
- import processing.serial.*;
- ControlP5 cp5;
- Knob rojo, verde, azul;
- Textlabel texto1, texto2, texto3, texto4, texto5, texto6;
- Serial serial;
- void setup()
- {
- serial = new Serial(this, Serial.list()[0],9600);
- String puerto = Serial.list()[0];
- size(620,400);
- cp5 = new ControlP5(this);
- rojo = cp5.addKnob("R",0,255,0,70,120,100);
- rojo.setColor(new CColor(0xFFff0000,0xFF9f9f00,0xFF5f0000,0xFFFFFFFF,0xFFFFFFFF));
- verde = cp5.addKnob("G",0,255,0,260,120,100);
- verde.setColor(new CColor(0xFF00FF00,0xFF9f9f00,0xFF005F00,0xFFFFFFFF,0xFFFFFFFF));
- azul = cp5.addKnob("B",0,255,0,450,120,100);
- azul.setColor(new CColor(0xFF0000ff,0xFF9f9f00,0xFF00005f,0xFFFFFFFF,0xFFFFFFFF));
- texto1 = cp5.addTextlabel("label")
- .setText("CONTROL DE LED RGB")
- .setPosition(25,48)
- .setColorValue(0xffff0000)
- .setFont(createFont("Ravie",30))
- ;
- texto2 = cp5.addTextlabel("label1")
- .setText("AZUL")
- .setPosition(475,235)
- .setColorValue(0xffff0000)
- .setFont(createFont("Comic Sans MS",15))
- ;
- texto3 = cp5.addTextlabel("label2")
- .setText("VERDE")
- .setPosition(280,235)
- .setColorValue(0xffff0000)
- .setFont(createFont("Comic Sans MS",15))
- ;
- texto4 = cp5.addTextlabel("label3")
- .setText("ROJO")
- .setPosition(95,235)
- .setColorValue(0xffff0000)
- .setFont(createFont("Comic Sans MS",15))
- ;
- texto4 = new Textlabel(cp5,"Estudiante: Juberth Andres Renteria",40,280,600,200);
- texto4.setFont(createFont("MV Boli",15));
- texto5 = new Textlabel(cp5,"Ingenieria Electronica",40,295,600,200);
- texto5.setFont(createFont("MV Boli",15));
- texto6 = new Textlabel(cp5,"Noveno semestre",40,310,600,200);
- texto6.setFont(createFont("MV Boli",15));
- }
- void draw()
- {
- background(100,70,20);
- texto4.draw(this);
- texto5.draw(this);
- texto6.draw(this);
- }
- void controlEvent (ControlEvent evento)
- {
- String nombre = evento.getController().getName();
- int valor = int(evento.getController().getValue());
- serial.write(nombre + ":" + valor);
- println(nombre + ":" + valor);
- }
Advertisement
Add Comment
Please, Sign In to add comment