Newbie struggling with controlP5 - Getting values from controls
in
Contributed Library Questions
•
1 year ago
Hi
I'm a complete newbie to processing, I don't think like a programmer and I'm generally very confused.
I'm trying to build a control interface for Arduino (no, I haven't mastered that either!!!) and I have several things that are really puzzling me, but I'll post them individually by control...
1) How do I get a variable to take the value of a slider? I need to get the current value of a slider so that I can then display it as part of a text label - valSlider1 = (slider value as float) + ("Secs") to show, say, "1.25 Secs". Once I have the value in a variable then I can send it over serial to the Arduino (I haven't investigated serial comms with processing yet).
2) How do I do the same thing with toggle buttons? I need to know which buttons in a functional group are pressed. These are "opt1" to "opt4", "t1 to t20", etc) and, as they are boolean I'm looking to know which ones are "1" or "true".
3) Are radio buttons achieved the same way as toggle buttons? I have read a few things relating to radio buttons but couldn't work what the authors were saying.
4) How do I set the control event of a push button to send a character over serial when pressed? I realise this should be relatively simple but I am really lost in the control events. At the moment the code produces the screen display I expect (if not quite what I want) but I get what I assume is a warning message in red that runs to many, many lines - the first of which begins
"14-Oct-2012 17:27:38 controlP5.ControlBroadcaster printMethodError
SEVERE: An error occured while forwarding a Controller event, please check your code at controlEvent
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at controlP5.ControlBroadcaster.invokeMethod(Unknown Source)
at controlP5.ControlBroadcaster.broadcast(Unknown Source).............................."
I have absolutely no idea what it's telling me (I thought Arduino error messages were obscure until now) but, as it is marked SEVERE then I assume that I ought to get it fixed.
Thanks for any help but, please, make it simple...
Duncan
I'm a complete newbie to processing, I don't think like a programmer and I'm generally very confused.
I'm trying to build a control interface for Arduino (no, I haven't mastered that either!!!) and I have several things that are really puzzling me, but I'll post them individually by control...
1) How do I get a variable to take the value of a slider? I need to get the current value of a slider so that I can then display it as part of a text label - valSlider1 = (slider value as float) + ("Secs") to show, say, "1.25 Secs". Once I have the value in a variable then I can send it over serial to the Arduino (I haven't investigated serial comms with processing yet).
2) How do I do the same thing with toggle buttons? I need to know which buttons in a functional group are pressed. These are "opt1" to "opt4", "t1 to t20", etc) and, as they are boolean I'm looking to know which ones are "1" or "true".
3) Are radio buttons achieved the same way as toggle buttons? I have read a few things relating to radio buttons but couldn't work what the authors were saying.
4) How do I set the control event of a push button to send a character over serial when pressed? I realise this should be relatively simple but I am really lost in the control events. At the moment the code produces the screen display I expect (if not quite what I want) but I get what I assume is a warning message in red that runs to many, many lines - the first of which begins
"14-Oct-2012 17:27:38 controlP5.ControlBroadcaster printMethodError
SEVERE: An error occured while forwarding a Controller event, please check your code at controlEvent
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at controlP5.ControlBroadcaster.invokeMethod(Unknown Source)
at controlP5.ControlBroadcaster.broadcast(Unknown Source).............................."
I have absolutely no idea what it's telling me (I thought Arduino error messages were obscure until now) but, as it is marked SEVERE then I assume that I ought to get it fixed.
Thanks for any help but, please, make it simple...
Duncan
1