04-29-2015 08:55 AM
Hello
I need to write my local variable state to a simple txt file only when it's true or false state changes.
for example, when my local variable 'temperature too high' is true, I need something like: temperature too high.
When it changes back to false i need: temperature OK. This with a date stamp.
It already worked to get a date stamp and to write the true or false state down but it always gets stuck in a while loop so the program keeps writing the same sentence.
Solved! Go to Solution.
04-29-2015 09:00 AM
Post your code so we can do more than guess at what the problem might be.
04-29-2015 09:10 AM
I had to take a picture with my phone because we're not allowed to connect the computers with an usb drive, I hope you can see it clear.
I know this while loop causes the program to write the same sentence over and over again but I don't know an other way to do it right.
Thanks
04-29-2015 09:50 AM - edited 04-29-2015 09:51 AM
Hi Tom,
pseudocode:
IF current boolean state <> previous boolean state THEN save data to file ENDIF
To check boolean state changes you can use the BooleanCrossing-PtByPt function…
04-29-2015 09:59 AM
That makes life a little easier. I did not know that was there. I guess I need to get out and look around more.
04-29-2015 10:07 AM
GerdW thank you very much, it works perfect now!