02-21-2011 01:15 PM
Hi,
I'm trying to log the time between a light turning on and off on a Lego NXT. In the attached jpeg you'll see an 85 ms wait between the light at 100 and 0%. When I run the VI I see the light tuning on/off and it looks like it is happening at an 85 ms frequency, but when I download the RedData.dat file and view the data, I see a bunch of zeros. Can somebody advise is I'm using the wrong approach here? Ultimately I'll remove the 85ms wait and put a Vernier hand dynamometer greater than VI so I can measure the response time it takes for a user to squeeze the dynamometer to turn the light off.
Thanks
02-22-2011 04:03 PM
Hi cgates,
It looks like you are programming your application correctly. I made a very similar example to test it out and it ran just fine. The only thing I wasn't sure on is what node you are using to write to the file? I don't recognize it. I was using the Write NXT File (num).vi
<Brian A | Applications Engineering | National Instruments>
02-24-2011 12:08 PM
Okay, I had the Add data point.vi instead of write nxt num.vi. I'll try it out. Thanks!
02-25-2011 02:21 PM
I tried the writenxtnum.vi for writing data to my file and I'm still getting bad data. In my program I turn a light turned on, an 85 ms timer, then turn the light off. The timer value which is written to file should be 85 ms, but I'm getting numbers like 231 ms, 306ms, etc. Attached is the VI.
I'm using the NXT because I have a light that I can connect to the NXT. I would be happy to turn on an indicator on the front panel which the user could respond to. Any suggestions?
Thanks,
Craig
02-25-2011 03:20 PM
Looking at your code, the timer is calculating how long it takes to turn on the light then wait 85 ms then turn off the light. The on and off operations are not going to be instantanious and this is why you are seeing a value higher than 85 ms. If you want to time the 85ms wait then reset the clock right before the wait and then read the clock right after.
<Brian A | Applications Engineering | National Instruments>