how can i use the keypressed function to move the slide??
here is the code:
import controlP5.*;
import processing.serial.*;
ControlP5 controlP5;
Serial serial;
void setup() {
// Draw the GUI window
size(400,350);
int serialPortNumber = 0;
// =======================================================
println(Serial.list());
String port = Serial.list()[serialPortNumber];
serial = new Serial(this, port, 9600);
// Add a vertical slider control
controlP5 = new ControlP5(this);
//("SLIDERNAME", min,max, startpos, xpos,ypos, width,height);
controlP5.addSlider("LED", 0,100, 50, 190,50, 20,200);
// Configure the slider properties
Slider s1 = (Slider)controlP5.controller("LED");
s1.setSliderMode(Slider.FLEXIBLE);
s1.setNumberOfTickMarks(21);
s1.showTickMarks(true);
s1.snapToTickMarks(false);
}
void draw() {
background(0);
}
void LED(float LEDvalue) {
// Grab slider value (0-100) and send to Arduino
int LEDbrightness = round(LEDvalue);
serial.write(LEDbrightness);
// uncomment the following line to debug
//println("LED: "+ LEDbrightness);
}
- i want to use the keyboard to move it!
can someone help me please! i am new to this and other programming languages!
1