Hi,
i have an arduino UNO whitch needs to communicate to visualbasic.
So i wrote a code to send a serial command to visual basic, then if visual basic answers with another serialcode then a variable changes so that arduino goes to a function, when i shutdown the visualbasic software it sends a serialcode to the arduino then the arduino answers with again another serial code and changes his variable back and leaves the function.
Everything works fine, my only problem is that it goes realy slow, like a serial command / seccond. Can you guys find out why ?
Is there a way of speeding this up to normal speed ?
The parseInt() function is waiting for something to indicate that the end of the int has arrived. So, send something. 12 will be a lot faster to parse than 12.
parseint() looks for an integer until either it sees a non-digit or it times out. The default timeout is one second. You can change the timeout (in milliseconds) using SetTimeout(). It might help if you reduce it to 100ms (or less).
See Serial.parseInt() - Arduino Reference and Serial.setTimeout() - Arduino Reference