system
March 31, 2010, 8:42pm
1
Hi
I am newbie to Arduino and I started with the examples provided by ARDX (temperature) CIRC-10 and it works fine with arduino software.
Now I am trying to do the same thing with processing and try to read analogpin 0 (as I have connected it to analogue 0)
println(arduino.analogRead(0));
it gives me always 0
What am I doing wrong? Thanks
Code:
Arduino arduino;
float myValue;
int temperaturePin = 0;
void setup()
{
println(Arduino.list());
arduino = new Arduino(this, Arduino.list()[1], 115200);
}
void draw()
{
println(arduino.analogRead(temperaturePin));
}
system
March 31, 2010, 8:59pm
2
Thats one pretty wicked code :-/
There is even no loop() in there..
system
March 31, 2010, 9:10pm
3
With processing u don't need loop, instead u have draw()
system
March 31, 2010, 11:06pm
4
Well, the first entry in the:
println([b]Arduino.list()[/b]);
arduino = new Arduino(this, [b]Arduino.list()[1][/b], 115200);
is Arduino.list()[0] and not [1] as it is an array, and the this,Arduino.list() shouldn't be this**.**Arduino.list()?
Have you set up the baud rate in arduino as the same in the processing code?
system
April 1, 2010, 6:57am
5
Ok , goodone! but the problem is not there!
I use com[7] wich is Arduino.list()[1] in this case as I print it the first thing in the code.
I tried many values for the Baud rate and of course 9600 as in the working example via arduin software.
system
April 1, 2010, 12:19pm
6
Found it.
I had to change the value of Baud rate in StandardFirmata as well to 9600.