Firmata and Arduino simple data stream

Firmata and Arduino simple data stream

Cancelled

Job Description

I need a very small piece of work done. This will best suit people experienced with the Arduino.

I have an Arduino with the Firmata firmware installed.

I want to set pins to PWM output.

I want to set the PWM values for these pins.

After connecting, I currently send; 0xF4, 0x0B, 0x03 to configure port 11 as PWM.

When I want to send values I send;
_spc->write(0x9B);
_spc->write(aAtt & 0x7F);
_spc->write((aAtt >> 7) & 0x7F);

where aAtt is the value I want to send (range 0-100), and _spc->write writes to the serial port.

I know the Arduino works because I can change the state of the pin using the Firmata test program.

For your information, the program I am writing that replaces another program. The other program works fine with the Arduino.

The big question is what am I doing wrong?

1. At what speed should I connect to the Arduino? I'm currently using 57600. And what I could gather from the other program is that it too connects at this speed.

2. After opening the serial port to the Arduino (in my case a virtual USB serial port), do you have to wait before sending any packets? If so, how long?

3. Are sure the byte stream I sent is correct?


Regards,

Soye