03-03-2016 05:08 PM - edited 03-03-2016 05:09 PM
Like this?
03-03-2016 05:13 PM
The for loop will only run as large as your auto-indexed array is (the number of rows I believe). If this is something that you want running during your entire program, I don't think that will suffice.
03-03-2016 05:26 PM - edited 03-03-2016 05:27 PM
Take a look at this example, where the data logging loop is on the bottom. Try it out and see how the "Logged Data" indicator only updates when the timer has elapsed, this is where you put your code to write to spreadsheet.
Press the "Logging?" Control to begin the timer.
Typically I use queues to transfer data between loops and tell loops when to stop, but I figured you might latch on to the local variable idea faster.
03-03-2016 05:29 PM
I was actually just dumping some P/C examples to my 2012 system to play around with. I'll try your suggestion. 😛
03-03-2016 05:39 PM
It looks like you beat me to it!
Here's my implementation with queues and stuff. The error handling could be done better, but now you have another reference!
(I resaved it for 2012)
The Continuous Measurement and Logging example project is another good reference.
03-03-2016 05:53 PM
Greg, you're a boss. I had no idea you could pass local variables to other loops. I thought loops were closed systems. It's so strange that I have a pretty good understand of what your code's doing but lack the imagination to come up with it. Thank you man. I'll run some tests tomorrow. Next step is putting timestamps next to each value in the file! Thank you man.
03-03-2016 06:04 PM
No problem! If your company has a software subscription, it is definitely worth asking them if you can use it to go through some online training. The Core 2 course would probably be very worthwhile to you right now.
03-03-2016 06:04 PM
This sounds dumb, but can I reset the timer with a button press? Or is this a stop/start?
03-03-2016 06:08 PM
If you go into the false case of "Logging?" you can make the boolean shift register a "True" (right now it runs straight through). Now whenever you switch to logging mode it will reset the timer. You will have the most recent time target, but you could put some logic in if you want to get back to your first time target.
03-03-2016 06:12 PM
Sweet. I'm not sure if we have a subscription. I think we did at one point but my boss got tired of paying the 600$ or so a year. The courses are a couple of thousand dollars I think.