[controlP5] Help with setValue()
in
Contributed Library Questions
•
3 years ago
I have searched the forums and didn't quite find the answer. I am new to processing and controlP5 so sorry for the simple question.
I am trying to add text field and have it update the time. I can't seem to get the controlP5 library to update the text field. below is my code. Thanks in advance.
I am trying to add text field and have it update the time. I can't seem to get the controlP5 library to update the text field. below is my code. Thanks in advance.
- import java.nio.ByteBuffer;
import processing.serial.*;
import controlP5.*;
float TimeInMs;
float TimeInMinutes;
float TimeInHours;
Serial myPort;
ControlP5 controlP5;
controlP5.Textfield Time_ET;
PFont AxisFont, TitleFont;
void setup()
{
frameRate(30);
size(400, 400);
println(Serial.list());
myPort = new Serial(this, Serial.list()[0], 9600);
controlP5 = new ControlP5(this);
controlP5.setColorBackground(50);
controlP5.setColorLabel(0);
Time_ET = controlP5.addTextfield("Time",200,200,60,20);
}
void draw()
{
background(200);
TimeInMs=millis();
TimeInMinutes=TimeInMs/60000;
TimeInHours=TimeInMs/3600000;
Time_ET.setValue(TimeInMinutes);
}
1