circuitcellar.com
Magazine Support   Digital Library   Products & Services   Suppliers Directory 
 
 





 

May 2004, Issue 166

Embedded Java Controllers


by D. Jay Newman

CODE

Listing 1 is the most important section of the code, the rest of which you may download from the Circuit Cellar ftp site is in the GpioServoMotor.java file. The code works on the principle of R/C servo pulses. In order to set the timing, I divided time into ticks, or 0.1-ms intervals.

The PianoRoll is a basic part of the processor’s waveform module. It starts a basic repetitive timer. The PeriodicThread uses this time signal.

I chose to use a PeriodicThread rather than a timer because, frankly, it was easier. Because I am controlling modified servos and electronic speed controllers, I don’t need the fine control that timers or direct control of the waveform module would give me. I know that I’ll do this at some point, just not today.