The link in the Contributed Libraries is broken and Joe Scully's site for this is also missing? Anyone either have a link or a fileset to share for this?
I've been pulling my hair out on this one. I can't get the CP5 dropdown list to work. I keep getting "Cannot find class or type named "DropdownList" error. I've checked CP5 versions and have v.1.5.2 running with Processing 1.5.1. The other CP5 examples work fine, and I've been using the ControlP5 library for over a year on several projects. I've also tried Processing 2.0.5 to no avail. It's as if the DropdownList" control is not in this library. Any suggestions?
My next step is to move to the latest version of Processing to see if that helps, but I'm using a lot of serial comms to an Arduino and have not had good luck getting the 2x versions of Processing to work correctly. Maybe it's time to revisit that, but if someone knows how to get P1.5.1 to work with CP5 DropdownList I'd be very grateful
Here's the example code that throws the error:
// controlP5 stuff
import controlP5.*;
ControlP5 controlP5;
DropdownList p1;
// define an array of images and the variable to select between them
PImage[] images = new PImage[2]; // array of images
int selectedImage; // the variable used to select the image to show on screen
void setup() {
size(400,400);
// create the controlP5dropdownlist and give it the name you will use later, in this case ImageSelect
I'm trying to extract the filename from a string loadPath (got from loadPath = selectInput() ). I need my user to load a file and then I background load other files that have the same filename but with a different extension. I therefore want to extract the filename and then issue a command to load the version with the different extension.
For example, if my user loaded image.jpg I'd like to also load image.png. I need to extract filename "image", append ".png" and load that.
I'm using
String[] qpath = splitTokens(loadPath,"\");
but Processing doesn't like "\" at all and won't let me split on that character. I wanted to split the path string into an array of pieces delimited by "\" and then I'd have the last array element which would be the filename.
Any suggestions as to a better way to get the filename, or how can I split a string on "\"?
I've searched high and low and can't find an example of changing the color of a cp5 label text. The ref docs point to a .setColor(int) method, but calling that method gives an error saying the function setColor() does not exist. I can use .setColorBackground() but it doesn't change anything. I'm using this in a HUD for an OpenGL application, but I can't find/create an example of even a regular use of a cp5 label where I can set the background color and/or text color. Seems like this should work.
Any ideas?
Here's the example cp5/OpenGL code using a label...
/**
* ControlP5 with PeasyCam support. tested with peasy 0.93
I have my Processing application running for my user as a double-clickable icon that launches the exported application. Is there a way in my code to know if the application is already running and then prevent the launching of a second/multiple instances of the application? My application uses serial comms to talk to an Arduino and multiple instances of the application crashes the serial comms.
My application restarts when a "restart" button is clicked. The restart basically resets all global variables and arrays and then runs Setup() again. This works fine for my needs except that within Setup() is the statement CreateGUI() to create the G4P GUI elements. Since I'm using G4P's floating panel the net result is another instance of this panel every time restart is clicked (and Setup() is run again). I suspect that the entire G4P interface is replicated, but the only visible issue is the multiple floating panels as they all can be opened/closed/dragged independently. I'd prefer to only initiate G4P if it doesn't already exist.
Is there a G4P property I can check for to see if it's already there (exists) before calling CreateGUI() ? I'm not seeing an obvious candidate in the library's reference docs.
I use the textWidth() function to allow me to increase or decrease the font size so that my user can continue to type in a box and the text scales to stay within the bounds of the on-screen rectangle. The logic is that if textWidth() of the entered string goes > box width, reduce the font size. If textWidth() goes down, increase the font size to a predetermined font size limit.
The issue is that while this looks ok on-screen until the text reaches the edges of the box and starts to reduce, the font decreases even though the width of the text is well witin the bounds of the box because of the reduced fontSize. txtWidth() continues to return increasing values for the string length even though the font size reduces the actual text width. I had expected textWidth() to decrease when I reduce the font size. I'm missing something obvious here (because my small test programs do give a reduced textWidth value with smaller font size) but after hours of pouring over the code and searching for an answer I'm not getting anywhere.
Thoughts? Here's the code...
void keyPressed() {
// onLine2, newLine are global boolean variables
// Box dims are held in an array as I have several boxes
I had 2.0a5 running in Ubuntu 10.04 and my app was working great, but I needed an exported linux32 application. That wouldn't work and I had to install Sun's Java6 JDK. Now I keep getting the following error when trying to run in the Processing IDE which did work prior:
Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version = RXTX-2.1-7
RXTX Warning: Removing stale lock file. /var/lock/LCK..ttyACM0
All I can find in reference to the stale lock file refers to very old issues. Anyone know whats' at the core of this and does the Java version have anything to do with this?
After a ton of work getting my dependencies sorted out and installing Sun's Java JDK I got Processing 1.2.1 running my program in present/fullscreen mode on Ubuntu 10.04. However, when I make the exported linux stand-alone a startup application in Ubuntu it crashes with a gray fullscreen. Works fine as a double-clicked application, but not as a startup item.
Any ideas? Anyone know of a way around this issue? I need my application to run as a "dedicated" system.
I need to make a Linux stand-alone executable but am making no progress. I can run my app in 2.0a4 but can make an executable from 2.0a4 because it has known issues creating Linux applications. I've tried 2.0a5 but both versions create an application shell script that when execute simply does nothing. I get some drive access and then nothing at all. I edited the backslash "typo" issue in the executable script from 2.0a4 to no avail.
My application needs to run on Ubuntu 10.04, but I've also tried this on Xbuntu/Xfce 4. I can run my application within Processing from the IDE but creating the stand alone application is not functioning. I can't revert to 1.5.1 as I need the Serial library which doesn't work with that version, 2.0 is recommended to overcome that issue. I tried reverting to 1.2.1 but can't get Processing to run in that version. Setting it's script to run as an executable also get's me nothing in response to executing it (either double-click or right-click and choose "execute" from menu). Using sudo bash gets me a permission error even when I provide my system password. My app and creating an application in Windows is no problem, but doesn't get me to a Ubuntu application.
Can anyone shed any light on this? I'm behind on this project and have a bunch or very irritated folks up my a$$ at the moment over this.
My Processing app works with Arduino in Ubuntu 10.04. Therefore in I can't use Processing 1.5.1 because of the documented Linux Java serial library bug in that version. I can get my app working in Processing 2.0a4 but can't get that version of Processing to export a Linux application.
2.0a4 creates the files for both Linux32 and Linux64 but neither work and running the executable script simply does nothing. No response. If I make the application in full-screen presentation mode (desired end result) I get a gray screen that hangs and cannot be killed without a reboot. I can get a running executable export from Processing 1.2.1 but not one that will work with my Arduino/serial comms.
The application runs fine under Processing 2.0a4, but not as a stand-alone application.
Anyone had this issue and maybe can recommend a solution/workaround?
The (65/100) is enumerating to zero(!?). Why does it not compute to .65? The two lines are identical except for one has the value 0.65 typed in while the other (non-working) one has the math (65/100). Are these not the exact same - why am I getting different results?
I didn't think it would be difficult to find an answer to this, but after much searching in vain I'm posting this question. How do I trap a function key press? I want my program to respond to function keys, but can't find a keypress or keycode function to suit.
I declare two global integer arrays BoxX[] and BoxY[] at the beginning of my program.
int BoxX[];
int BoxY[];
I have a procedure
void loadTemplateData(int Tnum) -
code below - to read a text file and stuff the arrays with integers from the text file. I can read and parse the numbers and display them back no problem, but as soon as I try to put the values into array slots I get the following error:
############# EXCEPTION IN EVENT HANDLER #############
An error occured during execution of the eventhandler:
When I comment out the lines that fill the array the procedure runs fine and displays the results in println statements. As soon as I un-comment the array fillers it runs the last println statement before filling the array and then throws the error.
I know the error refers to the G4P library but I think this is a programming issue as the G4P button simply calls the procedure and should have no involvement in the procedure - that is why I posted it here.
Here's the console output from lines 10, 13 & 14 when the array-filling lines (15,16,17) are commented out, showing that the textfile reading is sound:
Template Nametags, 8-up uses boxes 100 by 100 in the following locations:
In the following code, adding controls to the ControlWindow is not a problem, but for some reason using the same code that adds the slider and button fails with a textArea control. I want to display a label in the control window that can act as a status display, showing status text as the app runs.
I'm using ArcBall to rotate my OpenGL 3D plots and it works great, but it "takes over" mouse dragging function. I therefore can't find a way to pan across the plot to re-position my viewpoint, and then arcBall rotate from there. I was hoping I could use a keypress (such as SHIFT) + mouse drag to achieve this.
I'm drawing lines from coordinate data in a read-in data file. I use scale(1,-1) to set my origin (0,0) in the bottom left of the window instead of Processing's default top left. This all works fine until I draw labels on the data lines. The text is inverted and upside down, which is understandable given that I have flipped the screen.
Does anyone have a workaround for this. I'm sure there must be many examples of plotting from lower left and adding labels, but I'm not finding them.
I'm reading data that gives me the start and end points of a curve, and the X and Y offsets from the end point to the center of the arc. The data looks like this:
// FIRST POINT: X000.892787 Y000.303626
// SECOND POINT: X000.7555561 Y000.2055558 I-000.137122 J000.046827
where I is the offset from end point X to center X, and J is offset from end point Y to center Y.
The following is my test code to determine from this data the required elements for the arc() function, but I'm getting nothing. ANy suggestions as to what I'm missing or perhaps a better way to do this?
I have this baffling problem. I read a text file into an array and I need to identify lines that start with a specific character and only process those lines. I can isolate the leftmost character and display it, but my IF statement condition doesn't trap that line. I've searched extensively and can't identify the issue. I'm hoping someone can eyeball and spot/correct my error.
Here is my code:
for ( int i=0; i<lines.length; i++){ // cycle through the file line at a time
println("line "+i + " : " +lines[i]); // verify the line number and text of the line - all lines are printing fine
println(lines[i].substring(0,1)); // This prints the left-most character including the character wanted
if (lines[i].substring(0,1)=="S") { // Even though the previous line displays the character "S" this conditional // statement doesn't catch it and is ignored
// code to process line starting with "S"
}
}
So the above can extract for display the leftmost characters but using the same code as a condition in an IF statement doesn't activate even when the character wanted is matched.
Also, is there a Processing equivalent for the VB "left$" function (apart from what I'm using above)?
I have spent many days searching for an answer to this issue. I have Processing 1.5 and Ardino 1.0 on Ubuntu 10.04. Arduino IDE can talk to hardware but Processing can't, I initially had the RXTX version mismatch issue, but that no longer errors since I downloaded the RXTX Pre1 and placed it in the Processing folder as instructed elsewhere. That error is now gone, but now doing a simple Serial.list() gives an ClassNotFoundException: gnu.io.SerialPortEventListener error (after a lomg pause). String portName = Serial.list()[0]; gives the same error.
At this stage after not finding one full set of remedy steps, and after teasing out parts from various solutions, I think my Serial/RXTX components are probably messed up. I'm thinking I need to start over with a reinstall of Processing and Arduino and start afresh. I've not had any of these isseus in Windows and my project which is supposed to run in Ubuntu is now two weeks behind. I'm getting close to kicking Ubuntu and making this a Windows solution. I really don't want to do that so I'm hoping someone out there has gotten Ubuntu 10.04 (or I'll take whichever version works) to work with their Arduino and Processing and will share their step-by-step solution.
My program works fine in Windows and talks to my Arduino using "COM5" or whatever com port is listed in Windows Device Manager or in the Serial Port menu list in the Arduino IDE. Also in Windows I can use println(Serial.list()); to see a list of ports.
None of this seems to work in Linux (Ubuntu 10.04). The Arduino IDE gives me "/dev/tty/ACM0" as the Arduino USB port but inserting that string in my code (in place of "COM5") doesn't work (String portName = "/dev/tty/ACM0";). Furthermore Serial.list() gives nothing in Ubuntu. The println line executes but outputs nothing. If I try to assign the first available serial port with "String portName = Serial.list()[0];" I get an array out of range error.
Any suggestions? I have searched extensively and don't find much useful about naming USB ports in Processing in Ubuntu. Any help would be much appreciated.
After much work I have Processing running on Ubuntu 10.4, and my program running in Processing on Ubuntu (was using Win7). I can run the program, modify it, etc., and now all libraries etc., are functional. I set up an Ubuntu box for this as I want to ultimately provide my program as a stand-alone application on Ubuntu. Before I export my own code as an application I am trying to achieve this with the examples that come with Processing so as to have a known working setup. However, I cannot get any exported applications to work. I am testing with the example program "BrickTower".
I updated the Firefox Java plugin and can get the browser applet to work, but running the exported desktop application gives no response or error. I have tried running it with a double-click and from terminal with sudo prefix in case this was a permissions issue. All to no avail.
In the absence of any error, does anyone have any suggestions as to what's up with this? In Win7 the Applet and desktop application work. I have searched extensively on this topic and have so far have read a lot but nothing speaking to my issue with Ubuntu.
I'm simply trying to initiate a serial port and encountered this error anytime I tried
myPort = new Serial(this, Serial.list()[ndx], 9600);
where ndx is an int that cycles from 0 to < Serial.list().length. I thought it was my code and couldn't find any solution having read many many forum entries on this error. I then tried the "Simple Write" example that comes with P5 (v.1.5.1) and get the same error.
My RXTX versions are correct, and I get this before the error:
Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version = RXTX-2.1-7
I can see and list my COM ports and print the following to the console:
serial port(s) found
[0] "COM1"
[1] "COM3"
However, as soon as I try to establish a port to communicate with I get the following error, every time:
Error Inside Serial.<init>()
gnu.io.PortInUseException: Unknown Application
at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354)
at processing.serial.Serial.<init>(Unknown Source)
at processing.serial.Serial.<init>(Unknown Source)
at Comm2Hydra_not_working_v1.setup(Commtest_not_working_v1.java:57)
at processing.core.PApplet.handleDraw(Unknown Source)
at processing.core.PApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:662)
Exception in thread "Animation Thread" java.lang.RuntimeException: Error inside Serial.<init>()
at processing.serial.Serial.errorMessage(Unknown Source)
at processing.serial.Serial.<init>(Unknown Source)
at processing.serial.Serial.<init>(Unknown Source)
at Comm2Hydra_not_working_v1.setup(Commtest_not_working_v1.java:57)
at processing.core.PApplet.handleDraw(Unknown Source)
at processing.core.PApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:662)
I know there are (and I have read them) many posts on this topic but none have a reason as to why this error occurs nor how to remedy this. It also baffles me as to why the example code also doesn't work, perhaps indicating that there is some library component missing in my P5 installation? However I've double-checked everything I can think of to no avail.
Any assistance on this would be very helpful as my project is now dead in the water until I can get past this error.
I can't seem to find an answer to this, but I'm using a string array which is dimensioned with enough places to accommodate the range of data I'm generating. That means that most of the time when I use saveString to save the array to an ASCII file there's a ton of "null" lines at the end of the file after the relevant data lines. Is there any way to "trim" a string array before I send it to file?