前回のnode-redでLCD表示その2を少し変更しループなしで表示できるようにしました。LCDモジュールの初期化だけは時間をかける必要があるので別のフローにしてあります。
[{"id":"6a0bb275.50092c","type":"function","z":"e50639a8.db4118","name":"LCD表示","func":"// context.set('変数名',値); グローバル変数の設定\n// var val = context.get('変数名')||0;グローバル変数の読み込み\n// ||0; の部分は初期化指定 \n// 変数が設定されていない場合内は0に初期化\n\n//プロパティの追加\n//静的変数のように使用できる\n//注意: 外部からの参照も可能\nif (typeof this.times === 'undefined') {\n this.times = 0;\n}\n\nmsg.address = 0x3e;\n//msg.address = 59;\nswitch(times) {\n case 0:\n msg.command = 0x00;\n msg.payload = 0x38;\n break;\n case 1:\n msg.command = 0x00;\n msg.payload = 0x39;\n break;\n case 2:\n msg.command = 0x00;\n msg.payload = 0x14;\n break;\n case 3:\n msg.command = 0x00;\n msg.payload = 0x73;\n break;\n case 4:\n msg.command = 0x00;\n msg.payload = 0x56;\n break;\n case 5:\n msg.command = 0x00;\n msg.payload = 0x6c;\n break;\n case 6:\n msg.command = 0x00;\n msg.payload = 0x38;\n break;\n case 7:\n msg.command = 0x00;\n msg.payload = 0x01;\n break;\n case 8:\n msg.command = 0x00;\n msg.payload = 0x0c;\n break;\n case 9:\n msg.command = 0x00;\n msg.payload = 0xc0;\n break;\n default:\n return ; \n}\nthis.times++;\nreturn msg;","outputs":1,"noerr":0,"x":440,"y":460,"wires":[["3f3e776a.313c68","59fdff7a.0ccb1"]]},{"id":"efa65d49.0b2b5","type":"inject","z":"e50639a8.db4118","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":"","x":237,"y":460,"wires":[["6a0bb275.50092c"]]},{"id":"3f3e776a.313c68","type":"delay","z":"e50639a8.db4118","name":"","pauseType":"delay","timeout":"400","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":449,"y":372,"wires":[["6a0bb275.50092c"]]},{"id":"59fdff7a.0ccb1","type":"i2c out","z":"e50639a8.db4118","name":"","address":"","command":"","payload":"payload","payloadType":"msg","count":"1","x":680,"y":460,"wires":[]},{"id":"d41c3836.8f9b58","type":"function","z":"e50639a8.db4118","name":"LCD表示","func":"\n let lcdData = [\n// [0x00,0x38], 初期化データ\n// [0x00,0x39],\n// [0x00,0x14],\n// [0x00,0x73],\n// [0x00,0x56],\n// [0x00,0x6c],\n// [0x00,0x38],\n// [0x00,0x01],\n// [0x00,0x0c],\n// [0x00,0xc0],\n ];\n\nlet outputMsgs = [];\n\nconst LcdI2Caddr = 0x3e;\nlet i;\n\nfor(i=0;i