11-25-2021 09:36 AM
Hi.
So something that suspose to be pretty simple, is not taking a bit more time. Therefore I am reaching out to the community.
1) I have an 2D string array, that looks like this:
2) I need to check all values (i.e. in this case only 4 times) that the value stated out from "% as Butane" is not equal or above 1.8. I.e. the little program should do the following:
a) Get the string array, i.e. ["1.2", "1.3", "1.9", "1.8"] and check if just one of them are equal or above 1.8 in decimal format, some LED on the front HMI should light up.
3) I made it like this, but is there a better way?
11-25-2021 09:57 AM
This is basically correct. Almost every code can be improved, though. For example, the following code will do the same without a for loop and for an arbitrary number of peaks.
11-25-2021 10:07 AM
Hi, thanks for your reply.
I actually have another issue/question.
If I want to light up an LED, if any of them were true, how can I do that? I was thinking to use the shift register and then do like this... But perhaps I am getting too tired now 😄
11-25-2021 10:17 AM
Just use the Or Array Elements function in the Boolean palette.
11-25-2021 10:23 AM
@ChristianLiinHansen wrote:
Hi, thanks for your reply.
I actually have another issue/question.
If I want to light up an LED, if any of them were true, how can I do that? I was thinking to use the shift register and then do like this... But perhaps I am getting too tired now 😄
Can you explain what that picture has to do with the question?? This code is significantly worse than your first one. (e.g. x OR FALSE just returns x unchanged, the convoluted use of the shift register just makes you lose the value from the last iteration. Code does not scale well, for example if the array has 1000 elements the next time, you need a much bigger monitor and a few hours of work, etc.)