My application involves reading data off of a serial port at 26Hz. I am parsing this data in real time and writing statistics to file. I want to have an LED blink each time a file is written (I have a files being written in the following intervals: 1sec, 3sec, 15sec, 60sec, 10min). My problem is that the LED only stays illuminated for the single iteration, which is dictated by the speed I am reading from the serial port. Is there a clever way to have the LED flash for a standard .5 sec without creating timing issues?
In order to make an LED "blink" you can create a property node and select blinking.
Do you have the files written only 5 times at 1sec, 3sec, 15sec, 60sec, 10min, resulting in 5 files. Or do you have files written every 1sec, 3sec, 15sec, 60sec, 10min?
Thank you for the reply, I create a new set of five files at midnight and append to them throughout the day at the given interval. As I understand it the property node causes the LED to blink at a set interval. I am looking to have the LED blink at the predetermined interval (1sec, 3sec, 15sec...) and stay illuminated for 0.5sec each time it blinks. I have the triggering for the blinking worked out so that it blinks when I want it to, the problem is that it is in a while loop that is executing very quickly and so the LED doesnt stay illuminated for very long when it does blink. I hope that this helps.
Do you have other activity inside of this while loop? If not you can just put a Wait command that will keep the LED illuminated until the wait is over and the loop moves on to the next iteration.
Attaching your code will help as well
Message Edited by Steve.Briggs on 10-30-200711:33 AM
The while loop is primarly used to to read the serial port and write the data to file. The problem with using a wait millisecond command is that it will throw off the reading from the serial port, the most I can wait is 38 milliseconds otherwise I will miss data at the port. I will see about getting my code up, unfortunately I will be out of the office for most of today. Thank you very much for the help!
Somehow incorporating the wait with the timing intervals for your read could do the trick. For instance, you read at intervals no less than 1 second, so instead read at an interval of 0.5 second, and have the wait for 0.5 seconds. You'll get both the 0.5 second illumination of the LED and a read that performs 0.5 seconds after, giving you 1 second. Same thing goes for the other intervals you wish to read at.