Download this file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
FUNCTION_BLOCK EXAMPLE_FB VAR_INPUT MaxLevel: INT; END_VAR VAR_OUTPUT Out: STRING(255); VAR color_temp: JSONVAR; FirstScan: BOOL:= TRUE; ComposeJSON: STRUCT_TO_JSON; ========================================================================================================*) color_temp.CharString:= 'red'; ComposeJSON( JSONString:= ADR(Out), JSONStringSize:= SIZEOF(Out), JSONVars:= ADR(color_temp), NumberOfVars:= SIZEOF(color_temp) / SIZEOF(JSONVAR), MaxLevel:= MaxLevel ); IF FirstScan THEN FirstScan:= FALSE; ComposeJSON.Execute:= TRUE; END_IF