Go Down

Topic: Monitoring Serial Port in Perl without using 100% CPU (Read 987 times) previous topic - next topic

redcliffe

Hi,

I've implemented a Perl script using this page as a template: http://playground.arduino.cc/interfacing/PERL

The while(1) loop uses 100% of the CPU power available. Is there a way to do this without using so much processor load? In my case the Arduino spits out a line of telemetry once per second. The perl script reads this and inserts it into a db. Any suggestions about better ways to do this? Thanks,

David

robtillaart


put in a sleep of a few (10) milliseconds as the hardware will buffer several characters anyway ?

#include "all disclaimers"
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

PaulS

Code: [Select]
#include "all disclaimers"
What operating system allows spaces in file names?

zoomkat

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   8)

afremont

Try using "select" to wait for data with a timeout.  I think it's in IO::select.pm or something like that.
Experience, it's what you get when you were expecting something else.

Go Up