Receiving data by web.1 and change labels color accordingly

Hi All
My prject is on another PC without internet so it will be a chalanging to post blocks but i will try.
I am receiving data by WEb.1 got text block.
data looks like that: 100-H 200-LB 300-L...140-H.
On the app i have 14 labels with default color GREEN.
i need to turn each of them according to the data received.
Example: if 200-H the label Lb200 stays GREEN, if 200-L Lb200 turns RED, if 200-LB then Lb200 begin to blink RED/GREEN.
Data is comming from NANO as it monitors its inputs for High (H) or LOW (L) state and prints it to ESP then ESP do server upload.
I tryed to use the Any Label block but it came up a little hussle with its "to component" dock.
Again, i will try my best to come up with the blocks i have build but it is a little tricky here...
If anyone can help me with the right way to approach this will be great.
some blocks examples and guidance much appreciated.
Thank you

You will need something like this for each label

Fourteen pairs to each message?

This needs tables.

A Label table with two columns

  • Id (200/300/...)
  • Label component

An incoming message readings table

  • Id (200/300/...)
  • Associated code (H/L/...) from the last message

Easy message parsing

  • Split message at " " to get a list of readings ("200-H", ...)
  • Split reading at "-" to get a two item list (200,"H")

Search this board for FAQ Lists and FAQ Dictionaries

How do you use AI2 on such a setup?
This might be a waste of time.

Yeahhh...I know.
The PC with NET is a corporate station.
So i can only look for an examples and advises witch then i try to implement with some imporovisations...Not easy, but challanging.

Hi TIMAI2
Yes. your are right. I did try to do separately for each label.
so i do it in the clock 3 timer 16 times, the in a procedure 16 times.
That is why i asked if this can be done in more elegant way using the "any label" block and also what if the labes are 30, 50...100?
In fact i saw you were suggesting in other post using the "any label" block with "select item list, index" block, but i cannot find it now. I rememeber i liked the approuch there.

Yes, it is most likely possible to streamline the blocks coding using anyComponent blocks and lists.

Here you go

setButtonColours.aia (4.9 KB)

I added some blocks code in order to generate a new set of data for each button press, you will need to replace this with your own data arrival method. Clearing the variable on the button press is key to successful operation. I only used 5 labels for demo purposes, but should work with any number, if included in the labels list. This method relies on the order of things, labels list aligning with codes list...

BLOCKS

1 Like

i got it...found a way to transfer files...
this is my preaviouse version before i move to set the labels one by one.
This version i cound not go eny further as it was giving me error all the time.
I understand i am doing sometnig wrong but what...not good enough to determin.
O...and i found out i am using an older version but still good for blocks examples

NANO_ESP_AI2_1_2.aia (6.7 KB)