Hi,
I’m wondering how many bytes I should be able to send to arduino per frame in a reliable way.
I got some of adafruit neopixels (adafruit.com/products/1426), which look cool to play with, but now I’m wondering if it’s even possible to control a decent number of them through serial.
My simplest test goes as follow:
(using 255 as a separator, and else sending only byte per color value)
On Touch side, I’m doing :
for i in range(48):
op('serial1').sendBytes(i)
op('serial1').sendBytes(255)
On Arduino side I’m doing :
[code] serialIn = 0;
while(Serial.available() > 0) {
incomingByte = Serial.read();
if(incomingByte == 255) {
//Serial.println(0);
break;
}
else {
Serial.println(incomingByte);
pixels[serialIn] = incomingByte;
serialIn++;
}
}[/code]
With rate at 9600, it’s fairly reliable for 48 iterations as above, but starts to loose some packet near the end as soon as 64, when I read packet size in arduino is supposed to be 128.
And 9600 is awfully slow, it looks like it takes 1ms for one byte, so even for not that many RGB leds I can only refresh every few frames.
And I tried setting the rate at 115200, but then it starts to break a lot earlier, and I get lots of random values in arduino.
Is there a way to make it work at a higher rate?
Else do other have experience with this, anyway to stream more data to the arduino, or is is just not supposed to be used this way? (kinda wondering about the ethernet shield)
Thanks!
Vincent