We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Greetings!
So I've been trying to put together an app where I can turn a servo to either 90 or 0 degrees when it runs
So far I've had some good luck with Processing 2.2.1 where I'm able to send a arduino.servoWrite(9, 90);
command in the to the UNO board and it turns the servo, Yay!
But I need it to be a stand alone app so I can execute it with a bat file. When I create the app (Ctrl+E) I get the 100mb folder with everything in it (I hope) But when I try to run it, the servo does nothing :(
Here is my Code:
import processing.serial.*;
import cc.arduino.*;
Arduino arduino;
void setup() {
arduino = new Arduino(this, Arduino.list()[1], 57600);
arduino.pinMode(9, Arduino.SERVO);
}
void draw() {
arduino.servoWrite(9, 90);
}
Very simple nothing to extraordinary. But my success rate is declining now...
Oh and when I ran this for the first time it said it couldn't find cc.arduino so I had to click on Sketch - Add File - Arduino.jar for it to work. (not sure if this makes a difference or not)
I have tried to use the turn.java file in the source directory and javac turn.java to create a class so I can run it, but it said that it couldn't find any of the imports.
Any help with this will be amazing!
Answers
So when I try to compile with javac I get this
Ok so I managed to get all those errors away and have created the class for monitor_turn.
But I'm getting a new error.
Does anyone have any ideas?
HI, you have loaded the library "Firmata" in processing and arduino? Looking after the example "Arduino_Servo" in processing and load the sketch "ServoFirmata" in Arduino. "Arduino.cc" I think part of the Firmata library
@camperos Yes I have loaded the Firmata and uploaded it to my UNO board, that works from inside of Processing, but doesn't work out of it when an EXE
Bump!
Hi, the app turn.exe works well. I have JDK 1.7.0_25, check if you have set the bin path of the JDK in the environment variable "path"
@camperos thanks for your help - now in my \Program Files\Java I have 4 directories jdk1.6.0_25 - jdk1.7.0_45 - jre6 - jre7 I've checked the Environment variable Path like you said and it points to jdk1.7.0_45/bin path but it's still not working :(
I'm currently running Processing 2.2.1 64bit.
I figured a way around it :)
Mind telling us? People with the same problem would benifit...
Sure :)
Create your Sketch file.
Open notepad and add the following:
c:\myapp\processing-2.2.1\processing-java --run --sketch=c:\myapp\turn\ --output=c:\myapp\run\ --force
The first line "c:\myapp\processing-2.2.1\processing-java" is to locate the exe file processing-java which should be in the processing route directory. Run to tell it that you want to run this sketch file Sketch is the file that you have create and want to run. Output is the directory that it need to be outputted to. Force will forcibly remove the same directory and every time you run the command.
Now save the file as a .bat in any directory (cause we have told it where to look for the exe file)
Now run and enjoy the feeling :)
Note: There is an issue where sometimes the COM port comes back as busy. Maybe it's because the USB goes into standby or switches off. Not 100% sure.
+Note: All this is doing is uploading and running the sketch on the device, I still haven't figured out how to contently talk to the board.