2024年11月3日 星期日

2024_113_RFID 作業2 Node-Red程式

2024_113_RFID 作業2 Node-Red程式 


const char broker[] = "test.mosquitto.org";

//const char broker[] = "broker.mqtt-dashboard.com";

int        port     = 1883;

const char *SubTopic1 = "alex9ufo/2024/RFID/LED_control";

const char *PubTopic2 = "alex9ufo/2024/RFID/LED_status";

const char *PubTopic3 = "alex9ufo/2024/RFID/RFID_UID";









[{"id":"e0dec2aa1b0a5122","type":"ui_button","z":"945ffbf50a1b12c0","name":"","group":"ee086ab4c47d7171","order":1,"width":5,"height":1,"passthru":false,"label":"ON","tooltip":"","color":"","bgcolor":"green","className":"","icon":"","payload":"on","payloadType":"str","topic":"topic","topicType":"msg","x":90,"y":40,"wires":[["900ff9cafea98c7d","56231d75f39a8dbf","9acff35655511203"]]},{"id":"1954dc18d399e5dd","type":"ui_button","z":"945ffbf50a1b12c0","name":"","group":"ee086ab4c47d7171","order":2,"width":5,"height":1,"passthru":false,"label":"OFF","tooltip":"","color":"","bgcolor":"green","className":"","icon":"","payload":"off","payloadType":"str","topic":"topic","topicType":"msg","x":90,"y":80,"wires":[["900ff9cafea98c7d","56231d75f39a8dbf","9acff35655511203"]]},{"id":"e171636099d66df3","type":"ui_button","z":"945ffbf50a1b12c0","name":"","group":"ee086ab4c47d7171","order":3,"width":5,"height":1,"passthru":false,"label":"TIMER","tooltip":"","color":"","bgcolor":"green","className":"","icon":"","payload":"timer","payloadType":"str","topic":"topic","topicType":"msg","x":100,"y":120,"wires":[["900ff9cafea98c7d","56231d75f39a8dbf","9acff35655511203"]]},{"id":"3790a4bff86cdcc1","type":"ui_button","z":"945ffbf50a1b12c0","name":"","group":"ee086ab4c47d7171","order":4,"width":5,"height":1,"passthru":false,"label":"FLASH","tooltip":"","color":"","bgcolor":"green","className":"","icon":"","payload":"flash","payloadType":"str","topic":"topic","topicType":"msg","x":100,"y":160,"wires":[["900ff9cafea98c7d","56231d75f39a8dbf","9acff35655511203"]]},{"id":"900ff9cafea98c7d","type":"ui_audio","z":"945ffbf50a1b12c0","name":"","group":"ee086ab4c47d7171","voice":"Microsoft Hanhan - Chinese (Traditional, Taiwan)","always":true,"x":275,"y":100,"wires":[],"l":false},{"id":"56231d75f39a8dbf","type":"mqtt out","z":"945ffbf50a1b12c0","name":"Control LED","topic":"alex9ufo/2024/RFID/LED_control","qos":"1","retain":"true","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"70940176.2b2d3","x":350,"y":40,"wires":[]},{"id":"9f313fca3147ae42","type":"comment","z":"945ffbf50a1b12c0","name":"alex9ufo/2024/RFID/LED_control","info":"const char broker[] = \"test.mosquitto.org\";\n//const char broker[] = \"broker.mqtt-dashboard.com\";\nint        port     = 1883;\n\nconst char *SubTopic1 = \"alex9ufo/2024/RFID/LED_control\";\nconst char *PubTopic2 = \"alex9ufo/2024/RFID/LED_status\";\nconst char *PubTopic3 = \"alex9ufo/2024/RFID/RFID_UID\";\n//const char *PubTopic4 = \"alex9ufo/2024/RFID/RFID_PICC\";\n\nconst char willTopic[] = \"alex9ufo/2024/RFID/Starting\";","x":570,"y":40,"wires":[]},{"id":"9acff35655511203","type":"ui_text","z":"945ffbf50a1b12c0","group":"ee086ab4c47d7171","order":5,"width":5,"height":1,"name":"","label":"(L)發行到MQTT的資料 : ","format":"{{msg.payload}}","layout":"row-left","className":"","x":390,"y":160,"wires":[]},{"id":"97f5f427bb8d85ba","type":"mqtt in","z":"945ffbf50a1b12c0","name":"LED status ","topic":"alex9ufo/2024/RFID/LED_status","qos":"2","datatype":"utf8","broker":"70940176.2b2d3","nl":false,"rap":true,"rh":0,"inputs":0,"x":100,"y":300,"wires":[["a3b518eab0cff724"]]},{"id":"a3b518eab0cff724","type":"function","z":"945ffbf50a1b12c0","name":"function ","func":"msg.payload=\" ---ESP32回來資料---\" +msg.payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":260,"y":300,"wires":[["45f9744a6361bd69","21965fd09e226d61"]]},{"id":"45f9744a6361bd69","type":"ui_text","z":"945ffbf50a1b12c0","group":"ee086ab4c47d7171","order":6,"width":5,"height":1,"name":"","label":"(L)訂閱MQTT的資料 : ","format":"{{msg.payload}}","layout":"row-left","className":"","x":480,"y":300,"wires":[]},{"id":"21965fd09e226d61","type":"ui_audio","z":"945ffbf50a1b12c0","name":"","group":"ee086ab4c47d7171","voice":"Microsoft Hanhan - Chinese (Traditional, Taiwan)","always":true,"x":395,"y":340,"wires":[],"l":false},{"id":"cc69246b826e5005","type":"mqtt in","z":"945ffbf50a1b12c0","name":"新增 RFID","topic":"alex9ufo/2024/RFID/RFID_UID","qos":"2","datatype":"auto-detect","broker":"70940176.2b2d3","nl":false,"rap":true,"rh":0,"inputs":0,"x":100,"y":360,"wires":[["ab3b7a92be9a2dab","5962dedde48ef666","03810c759ac92c93"]]},{"id":"ab3b7a92be9a2dab","type":"ui_toast","z":"945ffbf50a1b12c0","position":"top right","displayTime":"3","highlight":"","sendall":true,"outputs":0,"ok":"OK","cancel":"Cancel","raw":false,"className":"","topic":"","name":"","x":290,"y":360,"wires":[]},{"id":"a91daa79603e0aaf","type":"ui_text","z":"945ffbf50a1b12c0","group":"511a4bc4145bfda6","order":1,"width":10,"height":2,"name":"","label":"RFID的uid","format":"{{msg.payload}}","layout":"row-left","className":"","x":530,"y":400,"wires":[]},{"id":"5962dedde48ef666","type":"function","z":"945ffbf50a1b12c0","name":"function ","func":"msg.payload=\" ------ESP32回來UID------  \" +msg.payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":280,"y":400,"wires":[["a91daa79603e0aaf","21965fd09e226d61","58cc595d2ca7cf4d"]]},{"id":"d7857fd993703346","type":"comment","z":"945ffbf50a1b12c0","name":"(template) - displaying a one dimensional table","info":"(template) - displaying a one dimensional table","x":750,"y":660,"wires":[]},{"id":"58cc595d2ca7cf4d","type":"delay","z":"945ffbf50a1b12c0","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":400,"y":460,"wires":[["51282a4dd2573ecf"]]},{"id":"51282a4dd2573ecf","type":"function","z":"945ffbf50a1b12c0","name":"function ","func":"msg.payload=\"                \"  ;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":540,"y":460,"wires":[["a91daa79603e0aaf"]]},{"id":"03810c759ac92c93","type":"function","z":"945ffbf50a1b12c0","name":"function ","func":"var no=global.get(\"countTemp\");\nvar data=msg.payload;\nmsg.payload={no,data}; \n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":160,"y":500,"wires":[["5c64e544d6b3502e","d3e7683a2bd816ec"]]},{"id":"9ac4df9bafb21449","type":"inject","z":"945ffbf50a1b12c0","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":200,"wires":[["125844c3789ebbdb"]]},{"id":"125844c3789ebbdb","type":"function","z":"945ffbf50a1b12c0","name":"function ","func":"var temp=0;\nglobal.set(\"countTemp\",temp);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":260,"y":200,"wires":[[]]},{"id":"5c64e544d6b3502e","type":"debug","z":"945ffbf50a1b12c0","name":"debug 308","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":330,"y":500,"wires":[]},{"id":"d3e7683a2bd816ec","type":"function","z":"945ffbf50a1b12c0","name":"function ","func":"var no=global.get(\"countTemp\") || 0;\nvar temp=global.get(\"rfid_store\") || [] ;\nvar data=msg.payload.data;\nmsg.payload={no,data}; \ntemp.push(msg.payload);\nno=no+1;\nglobal.set(\"countTemp\",no);\nglobal.set(\"rfid_store\",temp);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":320,"y":540,"wires":[["5a77341e25ce21d9","9ac21bcf2bd6bf52"]]},{"id":"5a77341e25ce21d9","type":"debug","z":"945ffbf50a1b12c0","name":"debug 310","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":490,"y":540,"wires":[]},{"id":"e4b2acd4367c2e3a","type":"debug","z":"945ffbf50a1b12c0","name":"debug 309","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":450,"y":660,"wires":[]},{"id":"a7f458c8fe02ce92","type":"ui_button","z":"945ffbf50a1b12c0","name":"","group":"511a4bc4145bfda6","order":2,"width":0,"height":0,"passthru":false,"label":"清除stack堆疊資料","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":130,"y":660,"wires":[["baebe63027eeb131"]]},{"id":"baebe63027eeb131","type":"function","z":"945ffbf50a1b12c0","name":"function ","func":"global.set('rfid_store',[]);\nglobal.set('countTemp',0);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":300,"y":660,"wires":[["e4b2acd4367c2e3a"]]},{"id":"9ac21bcf2bd6bf52","type":"function","z":"945ffbf50a1b12c0","name":"function ","func":"var temp=global.get(\"rfid_store\") || [] ;\nmsg.payload=temp; \nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":580,"wires":[["ce1e190051b16012","b7f115329e065945"]]},{"id":"ce1e190051b16012","type":"debug","z":"945ffbf50a1b12c0","name":"debug 311","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":650,"y":580,"wires":[]},{"id":"8acc187fca3752e6","type":"ui_template","z":"945ffbf50a1b12c0","group":"511a4bc4145bfda6","name":"Display","order":3,"width":10,"height":7,"format":"<table id=\"table\" border=\"1\">\n     <tr>\n        <th>number </th> \n        <th>UID number</th>\n </tr>\n <tbody>\n <tr ng-repeat=\"row in msg.payload\">\n   <td ng-repeat=\"item in row\" >{{item}}</td>\n </tr>\n </tbody>\n</table>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","className":"","x":780,"y":620,"wires":[[]]},{"id":"b7f115329e065945","type":"function","z":"945ffbf50a1b12c0","name":"function ","func":"var temp=global.get(\"rfid_store\") || [] ;\nmsg.payload=temp; \nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":640,"y":620,"wires":[["8acc187fca3752e6"]]},{"id":"262bc2f392ccdb78","type":"comment","z":"945ffbf50a1b12c0","name":"set global variable","info":"set global variable","x":130,"y":240,"wires":[]},{"id":"ed6c15c4665718c2","type":"comment","z":"945ffbf50a1b12c0","name":"MQTT參數","info":"const char broker[] = \"test.mosquitto.org\";\n//const char broker[] = \"broker.mqtt-dashboard.com\";\nint        port     = 1883;\n\nconst char *SubTopic1 = \"alex9ufo/2024/RFID/LED_control\";\nconst char *PubTopic2 = \"alex9ufo/2024/RFID/LED_status\";\nconst char *PubTopic3 = \"alex9ufo/2024/RFID/RFID_UID\";","x":500,"y":80,"wires":[]},{"id":"575629afc7416e13","type":"comment","z":"945ffbf50a1b12c0","name":"MQTT參數","info":"const char broker[] = \"test.mosquitto.org\";\n//const char broker[] = \"broker.mqtt-dashboard.com\";\nint        port     = 1883;\n\nconst char *SubTopic1 = \"alex9ufo/2024/RFID/LED_control\";\nconst char *PubTopic2 = \"alex9ufo/2024/RFID/LED_status\";\nconst char *PubTopic3 = \"alex9ufo/2024/RFID/RFID_UID\";","x":100,"y":420,"wires":[]},{"id":"2349a8efd984f6d2","type":"comment","z":"945ffbf50a1b12c0","name":"alex9ufo/2024/RFID/RFID_UID","info":"const char broker[] = \"test.mosquitto.org\";\n//const char broker[] = \"broker.mqtt-dashboard.com\";\nint        port     = 1883;\n\nconst char *SubTopic1 = \"alex9ufo/2024/RFID/LED_control\";\nconst char *PubTopic2 = \"alex9ufo/2024/RFID/LED_status\";\nconst char *PubTopic3 = \"alex9ufo/2024/RFID/RFID_UID\";\n//const char *PubTopic4 = \"alex9ufo/2024/RFID/RFID_PICC\";\n\nconst char willTopic[] = \"alex9ufo/2024/RFID/Starting\";","x":170,"y":460,"wires":[]},{"id":"75b40ac2892cc730","type":"comment","z":"945ffbf50a1b12c0","name":"clear global variable","info":"global.set('rfid_store',[]);\nglobal.set('countTemp',0);","x":130,"y":700,"wires":[]},{"id":"47e86dd019ee9ed7","type":"comment","z":"945ffbf50a1b12c0","name":"get  push data \"rfid_store\"","info":"","x":450,"y":620,"wires":[]},{"id":"6d8ceff921e14d5c","type":"comment","z":"945ffbf50a1b12c0","name":"push data into  \"rfid_store\" variable","info":"","x":240,"y":580,"wires":[]},{"id":"af78feeb3798187b","type":"comment","z":"945ffbf50a1b12c0","name":"set data  ","info":"","x":150,"y":540,"wires":[]},{"id":"51e794ffb163d823","type":"comment","z":"945ffbf50a1b12c0","name":"publish on , off , timer , flash to BROKER","info":"publish \"on , off , timer , flash\"  to BROKER\nby Topic : alex9ufo/2024/RFID/LED_control","x":460,"y":120,"wires":[]},{"id":"3571c490416d01bf","type":"comment","z":"945ffbf50a1b12c0","name":"清除 UID 號碼","info":"","x":550,"y":500,"wires":[]},{"id":"ee086ab4c47d7171","type":"ui_group","name":"LED控制顯示區","tab":"a83d954002d4689e","order":2,"disp":true,"width":5,"collapse":false,"className":""},{"id":"70940176.2b2d3","type":"mqtt-broker","name":"","broker":"test.mosquitto.org","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"15","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""},{"id":"511a4bc4145bfda6","type":"ui_group","name":"RFID區","tab":"a83d954002d4689e","order":1,"disp":true,"width":10,"collapse":false,"className":""},{"id":"a83d954002d4689e","type":"ui_tab","name":"2024_09_EX2_RFID","icon":"dashboard","order":134,"disabled":false,"hidden":false}]

沒有留言:

張貼留言

113 學年度第 1 學期 RFID應用課程 Arduino程式

113 學年度第 1 學期 RFID應用課程 Arduino程式 https://www.mediafire.com/file/zr0h0p3iosq12jw/MFRC522+(2).7z/file 內含修改過後的 MFRC522 程式庫 (原程式有錯誤) //定義MFRC522...