Closed elvis0288 closed 10 years ago
Yes, it indeed seems we did not wrap the pulseIn, for some reasons. We'll try to fix that soon.
I am doing a master project how long do you think it can take that to be insert it?
On March 22, 2014 8:26:13 AM Brice Morin notifications@github.com wrote:
Yes, it indeed seems we did not wrap the pulseIn, for some reasons. We'll try to fix that soon.
Reply to this email directly or view it on GitHub: https://github.com/SINTEF-9012/JArduino/issues/31#issuecomment-38351405
OK, I try to fix your issue, though I haven't tested yet. Can you try to check if it works?
Note that you also have to update the firmware on the Arduino board (as it has been updated too)
Yeah i can test it
On March 22, 2014 12:34:51 PM Brice Morin notifications@github.com wrote:
OK, I try to fix your issue, though I haven't tested yet. Can you try to check if it works?
Reply to this email directly or view it on GitHub: https://github.com/SINTEF-9012/JArduino/issues/31#issuecomment-38358256
this is probably a stupid question but i really dont know. when i did the first time i actaully download the jarduino 0.1.7 and use those jar for my eclipse. now with the modifications what folder or jar should i put in my eclipse? sorry and thanks
i already update my arduino firmware my problem now is make eclipse detect the new configuration i do not know what to do in there
ok so i just get all the java files and upload them to my eclipse the problem is that is cannot find import org.sintef.jarduino.comm.Serial4JArduino; and looking for it, it does not exist
Ah yes sorry, I didn't repackage the zip. So you should take directly the source from GitHub (including the firmware). Most things are in jarduino.core, but you can find serial port stuff in jarduino.serial
String serialPort; if (args.length == 1) { serialPort = args[0]; } else { serialPort = Serial4JArduino.selectSerialPort(); } JArduino arduino = new Ping(serialPort); arduino.runArduinoProcess();
this part is not working as it used to do it, it give an error about port in use and does not let me choose the port like it used to. but using this
public static void main(String[] args) { JArduino arduino = new Ping("COM4"); arduino.runArduinoProcess(); }
it works
when trying to use pulsein it give me this JArduino: Timeout waiting for the result of pulseIn
Ok, I think i see the problem. How long is your pulse? More than 500 ms I guess?
yes but the problem is that in arduino there is a method call delayMicroseconds(5); that one is not in your method so it is not doing like that
OK, I just added a timeout on the pulseIn method. Note that in the end, we actually call the pulseIn method on the Arduino, and if it needs a delayMicroSenconds(5), this methods is available on the Arduino side. However, we did not wrap any of the timing methods in Java, as Java provides more advanced timing methods by default, which you should use in JArduino.
The addition of the timeout parameter on the pulseIn method should solve your problem, Please note that this timeout is however not the one of the pulseIn(3) methods of the Arduino API. In JArduino, this timeout is the maximum time (in ms) that we wait for the pulseIn method to return a value.
Re-open this issue if it still not work for your use case
ok so i would like to read from an ultrasonic sensor and then extract how far it is for an obstacle avoidance my problem is that inJArduino there is not a pulsein method so how can i actually do this?
this is my arduino code
//code
int pingCenterF() { long duration; //Holds duration long inches; //Holds the distance to an obctacle in inches long cm; //Holds the distance to an obctacle in centimeters