Go Down

Topic: processing arduino program (Read 1 time) previous topic - next topic

abdelkhalek

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: [Select]
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);
}



PaulS

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.

abdelkhalek

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

PaulS

What kind of Arduino do you have?


Go Up