Its giving me an error while declaring the serialEvent as "unexpected token:void".
processing.app.SketchException: unexpected token: void
at processing.mode.java.JavaBuild.preprocess(JavaBuild.java:326)
at processing.mode.java.JavaBuild.preprocess(JavaBuild.java:197)
at processing.mode.java.JavaBuild.build(JavaBuild.java:156)
at processing.mode.java.JavaBuild.build(JavaBuild.java:135)
at processing.mode.java.JavaMode.handleRun(JavaMode.java:176)
at processing.mode.java.JavaEditor$20.run(JavaEditor.java:481)
at java.lang.Thread.run(Thread.java:662)
wats the error?I am still not able to figure out...Please help!!!
Interesting ... and where does the Arduino come into this? (drives the servo, yes)
May I suggest the Processing forum ( http://forum.processing.org )? Remember that Processing is based on Java, the Arduino is based on C++ - similar yet different
Lastly, the probable error is that you are nesting function defenitions.
mouseX and mouseY are used to read the mouses position. you cannot assign a value to them (or maybe you can, I dont know, but they will never move the curser).
How sure are you that arduino is the first serial port on that list? I'm sure mine is the last on the list. You really should have asked on Processing forum for this code.
but the processing forum is horrible to navigate and has an awkward layout and I personally dont like it at all ... and it is an arduino project, so let the guy ask his questions.
and especially (I didnt look at the code beyond the mouseX/mouseY issue) if the actual problem he has is in the setup of the serial communication
As some of the friends suggested it "was" the problem of nested functions ..i have corrected the same..
The serial communication is no problem as i had done many serial projects on arduino before..but i sent or received only one value...but this time i was experimenting with two values...
I have configured on one serial port on my laptop that is com7 so it always comes first in serial.list() at an index[0]...
Friends the problem i am now facing is that the mousex works but mouseY doesnt respond...
And lastly.. as some suggested that i should try the processing forum..i did it and i did it in the past too..but i get no replies and on this forum i get reply within a few minutes..
@liudr
the new code is this..but still the mouseY is not working and in the output window the value of mouseY is always 0..I didnt use the robotclass...
I have already explained to you. mouseX and mouseY are special variables reserved for reading the coordinates of your curser.
You are not interested in reading where your curser is. As far as I can tell, you are trying to move an ellipse within a processing sketch. Do not use mouseX and mouseY as variables for doing this, as it is bound to lead to problems.
You don't need to use mouseX or mouseY at all
just bung the interpreted serial data straight into drawing the ellipse.
MouseX and mouseY just map the position of the cursor within the sketch window.
You would use it the other way round normally, ie. using the mouse data for changing the background color (crap example).