2

I'm using the standard firmata to interface with Java Processing and run an arduino project. The Arduino class used to interface processing with java does not have a method for delayMicroseconds or any other delay on the arduino board. In most examples you need to use delay techniques in the java environment but these all operate on the order of milliseconds (1000 microseconds).

So I can edit the StandardFirmata sketch, the Firmata.java file and the Arduino.java file that makes all these necessary connections to run Processing. Does anyone understand how this code breaks down well enough so that I could add my own delay function that carries through to the arduino class. I don't understand how this code interfaces between the C and Java sides. A better understanding of this would probably help the most.

If you want to look at the reference code it can be found at: http://arduino.cc/en/reference/firmata#.UwfW_vldV0Y https://github.com/firmata/processing/tree/master/src

user3339232
  • 93
  • 1
  • 3

1 Answers1

1

I have not worked with the firmata interface, but the following works for processing sketches in general, but has only millisecond resolution (not microsecond):

    void myDelay(int ms)
    {
      try
      {    
        Thread.sleep(ms)
      }
      catch(Exception e) {
      }
    }
  • Unfortunately this does not meet my needs. That was what I originally used but I need a solution on the order of 100 microseconds, which is a fraction of a millisecond that java will not accept. – user3339232 Feb 24 '14 at 21:58