danielt
YaBB Newbies
Offline
Posts: 36
South Australia
controP5 with serial won't load in browser applet
Feb 26th , 2009, 12:45pm
Hiya, Firstly, I'm soo new to this. I've noticed that when I write sketches they run fine when I click the play button. But when I export them to web format, I just get a blank canvas? Also when I click on the java executable it created it says.. can't find class program will exit. Am I missing a vital step here? Here is a copy of the sketch I am trying to export: import processing.serial.*; // The serial port: Serial port; import controlP5.*; ControlP5 controlP5; int myColorBackground = color(0,0,0); void setup() { port = new Serial(this, Serial.list()[2], 9600); size(400,400); frameRate(30); controlP5 = new ControlP5(this); controlP5.addBang("bang",40,200,120,40); for(int i=0;i<4;i++) { controlP5.addBang("bang"+i,40+i*80,100,40,40).setId(i); } controlP5.controller("bang").setLabel("changeBackground"); } void draw() { background(myColorBackground); } void bang() { int theColor = (int)random(255); myColorBackground = color(theColor); println("a bang event. setting background to "+theColor); } void controlEvent(ControlEvent theEvent) { if (theEvent.controller().id()== 0){ println("hello!!!"); port.write('A'); //send A to serial port } else { port.write('a'); //send a to serial port } println( "## controlEvent / id:"+theEvent.controller().id()+ " / name:"+theEvent.controller().name()+ " / label:"+theEvent.controller().label()+ " / value:"+theEvent.controller().value() ); } Thanks in advance, Dan.