Pages: [1]   Go Down
Author Topic: processing arduino program  (Read 890 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hello all,
i'm trying to follow this tutorial to send feeds from my arduino to pachube http://community.pachube.com/?q=node/12
but the processing sketch always shows 0.0 as sensor value
i tried reading the value in firmata test application and it worked correctly ( that meens the circute is ok and the firmata is loaded correctly)

i'm using arduino demillanova and firmata library 2.2

this is the processing sketch:
Code:
import processing.serial.*;
import cc.arduino.*;

Arduino arduino;
float myValue;

void setup()
{
println(Arduino.list());
arduino = new Arduino(this, Arduino.list()[0], 115200);
}

void draw()
{
myValue = arduino.analogRead(0);
println(myValue);
}

Logged

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

The analogRead() function returns an integer value in the range 0 to 1023. Why are you storing the return value in a float.

You print a list of serial ports. You connect to the first one in the list. You might say something about the list printed, and whether your Arduino really is attached to the first port in the list.
Logged

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

thanks for the reply

actually my arduino is connected to the second port, so i changed it
and changed the float variable to integer baut i still get the same result
Logged

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

What kind of Arduino do you have?
Logged

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

demillanove
Logged

Pages: [1]   Go Up
Jump to: