Hello,
I'm new here and also a beginner in arduino's developpement and I have some questions about an Arduino NG with an atmega168 that I have.
I try to transfer the more informations I can (in my case it is boolean values) /second on the serial port.
For now, I just have a very simple program that just send a byte each time he could :
void setup() {
Serial.begin(19200);
}
void loop() {
Serial.println(255);
}
And recieved this signal with processing :
void setup() {
Serial port = new Serial(this, Serial.list()[0], 19200);
port.bufferUntil('\n');
}
void serialEvent(Serial port) {
String inString = port.readStringUntil('\n');
}
I got 390 strings/second on average, so if my calculs are good that 390 * (3 + 2) * 8 = 15600 bits/seconds
and 390 * 8 = 3120 boolean/second (remeber I want to transfer booleans or bits).
I can gain a bit by increasing the size of the number I'm sending and by calling print with a simple \n at the end but I want something faster.
And when I try a higher baud rate it doesn't work at all, or I got like 8 strings/seconds.
Why ? Is there a baud rate limit ? Cause when I looked at the atmega168 datasheet, they don't mention such a limit. But the boards.txt specify the upload rate to 19200.
Can I increase this limit ? Is there a way to output directly in a binary format (not an ASCII representation) my data ? This way I could send maybe 15000 booleans/second which should be enough.
EDIT : I didn't saw the Serial.write() method which answer my second question :).
Thank you for your attention,
Andréas