I made a program that uses a UDP library, and Firmata (processign 1.51 + Arduino 0.22).
I tried it on another computer and it doesn't work correctly.
When i'm using the firmata example (PWM), or with a custom program, when i use an analoguewrite command, the led flickers !
I tried different versions of firmata, and processing (i can't use 2.x because of my 1.51 udp library, and the x64 version doesn't include serial communications)
All builds of arduino since 0.20 to 1.5.1 , mixed with processing from 1.5.1 to 2.0b7 and 2.0b8 !
Java is updated, (i tried both x86 and x64 , for my x64 Windows Seven) And serial doesn't run in x64 mode, and the UDP library is for 1.5.1 only, so, i can't use 2.0b x86 (i get errors)
With firmata taken from arduino 1.5.1 example, and this code on processing 1.51, it works (i only got led flickering).
import processing.serial.*;
import cc.arduino.*;
import hypermedia.net.*;
Arduino arduino;
UDP udp;
void setup() {
udp = new UDP( this, 56551 );
udp.listen( true );
arduino = new Arduino(this, Arduino.list()[0], 57600);
}
void draw() {;}
void receive( byte[] data, String ip, int port ) {
int intspeed = (data[12] & 0xFF)
| ((data[13] & 0xFF) << 8)
| ((data[14] & 0xFF) << 16)
| ((data[15] & 0xFF) << 24);
float floatspeed = Float.intBitsToFloat(intspeed);
floatspeed = 3.6*floatspeed;
float vitesse=map(floatspeed,0,100,0,255);
int pwm=int(vitesse);
println(floatspeed);
arduino.analogWrite(9,pwm);
//reste a trovuer quelles DATA sont les bonnes
}
I plugged my Duemilanove in, opened Arduino 1.0.3, and located the AnalogFirmata sketch. I selected the correct board and correct serial port, and uploaded the AnalogFirmata sketch.
Then, I started Processing 1.5.1, and loaded the sketch in reply #2. I changed the index into the list, because my Arduino is connected to the second port in the list.
I started the Processing app running, and the TX and RX lights on the Duemilanove started flashing, and the LED on pin 3 came on very dimly, but solid.
I changed the value in the analogWrite statement in the Processing sketch, and the LED changed brightness according, with no flicker.
I'm running Win7, 64 bit, but I doubt that that matters.
From what I can tell, at least with the Duemilanove, Firmata is working just fine.
Now, It's time for you to tell us which Arduino models you are using/having issues with.