Hi to all!
I tried to read serial data from my Arduino board, i get values, but not the desired ones :S
This are my basics programms:
In ARDUINO:
What I am doing wrong?
I use Ubuntu 10.10 and a Arduiono Duemilanove ATmega 168
Thanks to all :)
I tried to read serial data from my Arduino board, i get values, but not the desired ones :S
Instead of getting 0 o 254 if connected to ground or 5 V.Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version = RXTX-2.1-7
RXTX Warning: Removing stale lock file. /var/lock/LCK..ttyUSB1
[0] "/dev/ttyUSB1"
50
53
52
13
10
50
53
52
...
This are my basics programms:
In ARDUINO:
- void setup() {
Serial.begin(9600);
}
void loop() {
int sensorValue = analogRead(A0);
sensorValue = map(sensorValue,0,1023,0,254); // To a number 0..254
Serial.println(sensorValue);
}
- // Example by Tom Igoe
import processing.serial.*;
Serial myPort; // The serial port
void setup() {
// List all the available serial ports
println(Serial.list());
// I know that the first port in the serial list on my mac
// is always my Keyspan adaptor, so I open Serial.list()[0].
// Open whatever port is the one you're using.
myPort = new Serial(this, Serial.list()[0], 9600);
}
void draw() {
while (myPort.available() > 0) {
int inByte = myPort.read();
println(inByte);
}
}
What I am doing wrong?

I use Ubuntu 10.10 and a Arduiono Duemilanove ATmega 168
Thanks to all :)
1