-
Notifications
You must be signed in to change notification settings - Fork 23
Hello World
bartbutenaers edited this page Aug 19, 2021
·
3 revisions
It is common for each programming language to display "Hello World"
This can be done using following example flow:
[{"id":"726f49bab272a7c8","type":"inject","z":"c2a7925b.6e143","name":"Start","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":920,"y":340,"wires":[["a9f0963b0aa786f9"]]},{"id":"a9f0963b0aa786f9","type":"Blockly","z":"c2a7925b.6e143","func":"msg['payload'] = 'Hello world';\nnode.send([msg]);\n","workspaceXml":"<xml xmlns=\"https://developers.google.com/blockly/xml\">\n <block type=\"node_object_set\" id=\"{HhMU.r!93@,X*U]cnOO\" x=\"-312\" y=\"-187\">\n <value name=\"object_field\">\n <shadow type=\"node_msg\" id=\"DSrocV,iepv#xI5CNnR*\"></shadow>\n </value>\n <value name=\"field_name\">\n <shadow type=\"text\" id=\"QY[2X`uT|j(|9hEjRP@i\">\n <field name=\"TEXT\">payload</field>\n </shadow>\n </value>\n <value name=\"value_field\">\n <shadow type=\"text\" id=\"#!`_0-/,RL$v7g2V3k5[\">\n <field name=\"TEXT\">Hello world</field>\n </shadow>\n </value>\n <next>\n <block type=\"node_send\" id=\"FUZ=O)cx}X$rVR|}@noO\">\n <field name=\"OUTPUT_NR\">1</field>\n <value name=\"MESSAGE_INPUT\">\n <shadow type=\"node_msg\" id=\"X,6T+0~8X!$Xd?G}Q-Ot\"></shadow>\n </value>\n </block>\n </next>\n </block>\n</xml>","outputs":1,"blocklyConfig":"46e073e1.66e10c","backpackContents":[],"noerr":0,"name":"","x":1090,"y":340,"wires":[["b8f850db4b40e28b"]]},{"id":"b8f850db4b40e28b","type":"debug","z":"c2a7925b.6e143","name":"Blockly output","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1280,"y":340,"wires":[]},{"id":"46e073e1.66e10c","type":"blockly-config","language":"en","showTrashcan":true,"allowComments":true,"showZoomControl":true,"enableBackPack":true,"backpackContents":["<block xmlns=\"https://developers.google.com/blockly/xml\" type=\"object_create\" inline=\"true\"><mutation xmlns=\"http://www.w3.org/1999/xhtml\" num_fields=\"1\"><field name=\"property name\"></field></mutation><field name=\"field1\">payload</field></block>","<block xmlns=\"https://developers.google.com/blockly/xml\" type=\"node_return_message\"><field name=\"OUTPUT_NR\">1</field><value name=\"MESSAGE_INPUT\"><shadow type=\"node_msg\"></shadow></value></block>","<block xmlns=\"https://developers.google.com/blockly/xml\" type=\"node_object_set\" inline=\"true\"><value name=\"object_field\"><shadow type=\"node_msg\"></shadow></value><value name=\"field_name\"><shadow type=\"text\"><field name=\"TEXT\">payload</field></shadow></value><value name=\"value_field\"><shadow type=\"text\"><field name=\"TEXT\"></field></shadow></value></block>","<block xmlns=\"https://developers.google.com/blockly/xml\" type=\"node_object_get\"><mutation xmlns=\"http://www.w3.org/1999/xhtml\" action=\"GET\"></mutation><field name=\"action\">GET</field><value name=\"object\"><shadow type=\"node_msg\"></shadow></value><value name=\"field_name\"><shadow type=\"text\"><field name=\"TEXT\">payload</field></shadow></value></block>"],"toolboxPosition":"left","renderer":"geras","categories":[{"name":"Node-RED","files":["blockly-contrib/npm/node-red-contrib-blockly/lib/nodered/nodeRedBlocksCodeGen.js","blockly-contrib/npm/node-red-contrib-blockly/lib/nodered/nodeRedBlocksDefs.js","blockly-contrib/npm/node-red-contrib-blockly/lib/nodered/toolbox.xml","blockly-contrib/npm/node-red-contrib-blockly/messages/en.js"]},{"name":"Objects","files":["blockly-contrib/npm/node-red-contrib-blockly/lib/json/objectBlocksCodeGen.js","blockly-contrib/npm/node-red-contrib-blockly/lib/json/objectBlocksDefs.js","blockly-contrib/npm/node-red-contrib-blockly/lib/json/toolbox.xml","blockly-contrib/npm/node-red-contrib-blockly/messages/en.js"]},{"name":"Buffer","files":["blockly-contrib/npm/node-red-contrib-blockly/lib/buffer/bufferBlocksCodeGen.js","blockly-contrib/npm/node-red-contrib-blockly/lib/buffer/bufferBlocksDefs.js","blockly-contrib/npm/node-red-contrib-blockly/lib/buffer/toolbox.xml","blockly-contrib/npm/node-red-contrib-blockly/messages/en.js"]},{"name":"Date/time","files":["blockly-contrib/npm/@blockly%2Ffield-date/dist/date_compressed.js","blockly-contrib/npm/node-red-contrib-blockly/lib/datetime/dateTimeBlocksCodeGen.js","blockly-contrib/npm/node-red-contrib-blockly/lib/datetime/dateTimeBlocksDefs.js","blockly-contrib/npm/node-red-contrib-blockly/lib/datetime/toolbox.xml","blockly-contrib/npm/node-red-contrib-blockly/messages/en.js"]},{"name":"Timer","files":["blockly-contrib/npm/node-red-contrib-blockly/lib/timer/timerBlocksCodeGen.js","blockly-contrib/npm/node-red-contrib-blockly/lib/timer/timerBlocksDefs.js","blockly-contrib/npm/node-red-contrib-blockly/lib/timer/toolbox.xml","blockly-contrib/npm/node-red-contrib-blockly/messages/en.js"]},{"name":"Blockly extension","files":["blockly-contrib/npm/node-red-contrib-blockly/lib/extra/extraBlocksCodeGen.js","blockly-contrib/npm/node-red-contrib-blockly/lib/extra/extraBlocksDefs.js","blockly-contrib/npm/node-red-contrib-blockly/lib/extra/toolbox.xml","blockly-contrib/npm/node-red-contrib-blockly/messages/en.js"]},{"name":"Blockly standard","files":["blockly-contrib/npm/node-red-contrib-blockly/lib/basic/toolbox.xml"]}],"customizeToolbox":false,"name":""}]
Which is explained in following demo: