Pages: [1]   Go Down
Author Topic: Arduino - Firmata, not working correctly  (Read 1351 times)
0 Members and 1 Guest are viewing this topic.
France
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi !

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)

How can i solve this ?

Thanks !

Pierre  smiley

Logged

I apologize for my poor english.

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 548
Posts: 46029
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I made a program that uses a UDP library, and Firmata (processign 1.51 + Arduino 0.22).
But, you are not going to share them?

Quote
How can i solve this ?
Fix the code that doesn't work.
Logged

France
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Don't be mad !

Here's the code
Code:
import processing.serial.*;
import cc.arduino.*;

Arduino arduino;

void setup() {
  size(10, 10);
  arduino = new Arduino(this, Arduino.list()[0], 57600);
}

void draw() {
  arduino.analogWrite(3,10);
// i tried to use delays , nothing changed ...
}


When i do this, my led connected on the third pin is blinking !

All of my previous programms worked like a charm, but now that i've got a new PC, it doesn't work anymore.
Logged

I apologize for my poor english.

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 548
Posts: 46029
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You got a new PC, and installed old software on it. Why? You should be using 1.0.3, or the just released 1.0.4.
Logged

France
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Actually i tried a lot of things:

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).

Code:
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
}

Logged

I apologize for my poor english.

France
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Any idea of why i cant run the very simple example , 2 posts ago ?

I've posted all my code smiley

Thanks
Logged

I apologize for my poor english.

LONDON UK
Offline Offline
Full Member
***
Karma: 0
Posts: 105
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i got the same problem i cant get firmata working at all .been trying for ages
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 548
Posts: 46029
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

France
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for trying this.

I tried on two different Uno R3. (one used to work with this code, on another computer)

I tried with correct values, like "COM3" , in my case. I was able to read and write digital values on ports, but i can't use analogwrite !

I agree with you, it worked on 2 other computers, Both 7 x64, so, do you think it's a problem with java or something else ?

I tried to reinstall drivers, without success.

I'm going to try on another PC (over windows 8 x64) at noon.

Thanks for your answer!  smiley



 
« Last Edit: March 14, 2013, 03:41:54 am by Pierro » Logged

I apologize for my poor english.

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 548
Posts: 46029
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
but i can't use analogwrite
With which Firmata sketch installed? There are several...
Logged

France
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry i couldn't try on another PC (i'm at work)

I tried all firmata versions (standard, pwm only , spcial for uno rev3) on all versions of arduino program (i mentioned earlier)

I'll try after work !

Thanks.
Logged

I apologize for my poor english.

Pages: [1]   Go Up
Jump to: