Home > Forum > IEC 61131 Programming (LogicLab) > How to send data to the Beebotte portal
- This topic has 3 replies, 2 participants and was last updated 4 years, 6 months ago da Sergio Bertana.
-
AuthorPost
-
September 12, 2019 at 4: 27 pm #49612pierluigi parolaroParticipant
I would like to use the beebotte portal in a project, I read the knowledge on the site but I did not understand how to publish multiple values simultaneously at intervals of a minute for now 8 values would be REAL and 8 values BOOL.
September 13, 2019 at 6: 24 am #49632Sergio BertanaAdministrator ForumIf you refer to the FB manual MQTTBeebotte, you will see that I have allocated an array of FBs TPBeebotte, and at each activation of the bit of Publish of the FB the data addressed by the parameter is sent Resource to the Beebotte platform.
So in your case you can define an array of 16 FBs TPBeebotte, and to associate to each the REAL and BOOL variable that you must send to the service, upon activation of the command of Publish of each the relative variable will be sent. You can also activate all 8 command bits at the same time, sending will then be automatically managed by the FB.
September 24, 2019 at 12: 25 pm #49972pierluigi parolaroParticipantHow do I define an array of function blocks? And to assign the related variables, I could give an example.
September 24, 2019 at 12: 41 pm #49976Sergio BertanaAdministrator ForumThe example is in the program that you find in the manual of the FB MQTTBeebotte, in practice admitting we have to publish 8 variables we will have.
// Dichiarazione array di 8 pubblicazioni. TPublish : ARRAY[ 0..7 ] OF TPBeebotte; (* Topic publish *) // Definizione per ogni pubblicazione della variabile da pubblicare. // Viene definito il canale e la risorsa "Channel/Resource" // Il tipo e l'indirizzo della variabile il cui valore và pubblicato. TPublish[0](Resource:=ADR('Channel/Resource1'), DType:=REAL_TYPE, DBuffer:=ADR(Var1), DBLength:=0); TPublish[1](Resource:=ADR('Channel/Resource2'), DType:=BOOL_TYPE, DBuffer:=ADR(Var2), DBLength:=0); ... TPublish[7](Resource:=ADR('Channel/Resource7'), DType:=UINT_TYPE, DBuffer:=ADR(Var7), DBLength:=0); // Eseguo pubblicazione ogni 5 secondi. IF ((SysGetSysTime(TRUE)-TimeBf) > 5000000) THEN TimeBf:=SysGetSysTime(TRUE)-TimeBf); //Time buffer (uS) FOR i:=0 TO 7 DO TPublish[i].Publish:=TRUE; END_FOR; END_IF;
Of course, the definition of the array must be defined in the declaration area, the initialization can be done in the first loop and the rest in the main. But if you follow what is written in the manual I think everything is clear.
-
AuthorPost
- You must be logged in to reply to this topic.