Arduino Processing serial slow

edited September 2015 in Arduino

Hi there,

I've put this same question on the Arduino forum and not getting anywhere really (http://forum.arduino.cc/index.php?topic=350736.0)

I've got a LED matrix that I'm sending a stream of real-ish time data to from a processing sketch. This is working fine and what I want displayed is appearing on the screen, albeit with a undesirable frame rate. I've narrowed the problem down to where the processing sketch actually sends out the data:

sPort = new Serial(this, "COM11", 115200);

`

int t1 = millis(); for(int y = 0; y < 11; y++) { for(int x = 0; x < 11; x++) { sPort.write(buffer[y][x][0]); //red sPort.write(buffer[y][x][1]); //green sPort.write(buffer[y][x][2]); //blue } } int t2 = millis(); println("SENDING DATA: " + (t2 - t1) / 1000.0F);`

From that I'm getting that it takes ~360ms to send the data out meaning I get a frame rate of about 2-3 frames a second. I'm using 115200 bps Serial which should give me 11520 bytes/sec, and as I'm sending 121*3 = 363 bytes, this should give a max frame rate of ~30 fps minus any other overheads. It appears that processing is sending at nowhere near the correct speed.

Anyone have any ideas for what I can change on either the processing or arduino side?

I am using Windows 7, 64bit. I have tried using an empty sketch on the arduino and that has the same results so I know it's not a delay introduced there.

Thanks in advance, Andy

Tagged:

Answers

  • I have also tried using this to send to COM1, I don't know what that device is however it successfully transfers at 115200

Sign In or Register to comment.