[ { "id": "26667300.231ed6", "type": "tab", "label": "SerialCamera", "disabled": false, "info": "" }, { "id": "1cf2bee3.1e5c49", "type": "serial request", "z": "26667300.231ed6", "name": "", "serial": "7b1a2a97.73a96c", "x": 576.75, "y": 92.75, "wires": [ [ "bba19df0.8bbae8" ] ] }, { "id": "f3686357.1c5608", "type": "function", "z": "26667300.231ed6", "name": "送信コマンド", "func": "var buf = new Buffer(4); \n\nbuf[0]=0x56;\nbuf[1]=0x00;\nbuf[2]=0x26;\nbuf[3]=0x00;\n\nmsg.payload = buf;\nreturn msg;\n", "outputs": 1, "noerr": 0, "x": 406.800048828125, "y": 91.98333740234375, "wires": [ [ "1cf2bee3.1e5c49" ] ] }, { "id": "46fc2bca.288e44", "type": "inject", "z": "26667300.231ed6", "name": "Reset", "topic": "", "payload": "", "payloadType": "date", "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "x": 101.80001831054688, "y": 88.98332214355469, "wires": [ [ "f3686357.1c5608" ] ] }, { "id": "41f1fbc0.fe6664", "type": "debug", "z": "26667300.231ed6", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "x": 865.75, "y": 90.2833251953125, "wires": [] }, { "id": "bba19df0.8bbae8", "type": "function", "z": "26667300.231ed6", "name": "変換", "func": "var val=\"Unkown\";\n\n\nif(msg.payload[0]==0x76 && msg.payload[2]==0x26 )\n{\n val=\"Reset OK\";\n}\nelse if( msg.payload[0]==0x76 && msg.payload[2]==0x36)\n{\n val=\"Capture/Stop IMG OK\";\n}\nelse if( msg.payload[0]==0x76 && msg.payload[2]==0x34)\n{\n var size = (msg.payload[7]<<8)+msg.payload[8];\n val=\"Size: \"+size+ \" byte\";\n global.set(\"SerialCameraFileSize\",size);\n \n var block=48;\n global.set(\"SerialCameraFileBlockSize\",block);\n global.set(\"SerialCameraLoopSize\",size/block);\n}\nelse if( msg.payload[0]==0x76 && msg.payload[2]==0x31)\n{\n val=\"Set Resolution OK\";\n}\n\n\n\n\n\nmsg.payload=val;\nreturn msg;", "outputs": 1, "noerr": 0, "x": 706.75, "y": 93.75, "wires": [ [ "41f1fbc0.fe6664" ] ] }, { "id": "7e4bc018.e0e6a8", "type": "function", "z": "26667300.231ed6", "name": "送信コマンド", "func": "var buf = new Buffer(5); \n\nbuf[0]=0x56;\nbuf[1]=0x00;\nbuf[2]=0x36;\nbuf[3]=0x01;\nbuf[4]=0x00;\n\nmsg.payload = buf;\nreturn msg;\n", "outputs": 1, "noerr": 0, "x": 397.75, "y": 155.75, "wires": [ [ "1cf2bee3.1e5c49" ] ] }, { "id": "bc62ee84.a66a08", "type": "inject", "z": "26667300.231ed6", "name": "Capture Image", "topic": "", "payload": "", "payloadType": "date", "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "x": 119.74996948242188, "y": 153.75, "wires": [ [ "7e4bc018.e0e6a8" ] ] }, { "id": "888a4f2c.aae298", "type": "function", "z": "26667300.231ed6", "name": "送信コマンド", "func": "var buf = new Buffer(5); \n\nbuf[0]=0x56;\nbuf[1]=0x00;\nbuf[2]=0x34;\nbuf[3]=0x01;\nbuf[4]=0x00;\n\nmsg.payload = buf;\nreturn msg;\n", "outputs": 1, "noerr": 0, "x": 399.75, "y": 226.75, "wires": [ [ "1cf2bee3.1e5c49" ] ] }, { "id": "77b9f7dc.e343d", "type": "inject", "z": "26667300.231ed6", "name": "Read Data Length", "topic": "", "payload": "", "payloadType": "date", "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "x": 120.74996948242188, "y": 226.75, "wires": [ [ "888a4f2c.aae298" ] ] }, { "id": "7e3cb7c7.a27568", "type": "function", "z": "26667300.231ed6", "name": "送信コマンド", "func": "var buf = new Buffer(5); \n\nbuf[0]=0x56;\nbuf[1]=0x00;\nbuf[2]=0x36;\nbuf[3]=0x01;\nbuf[4]=0x03;\n\nmsg.payload = buf;\nreturn msg;\n", "outputs": 1, "noerr": 0, "x": 394.75, "y": 293.75, "wires": [ [ "1cf2bee3.1e5c49" ] ] }, { "id": "cc2cfc69.66b87", "type": "inject", "z": "26667300.231ed6", "name": "Stop Capture", "topic": "", "payload": "", "payloadType": "date", "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "x": 110.74996948242188, "y": 293.75, "wires": [ [ "7e3cb7c7.a27568" ] ] }, { "id": "8c7dc9b9.95e968", "type": "function", "z": "26667300.231ed6", "name": "送信コマンド", "func": "var buf = new Buffer(9); \n\nbuf[0]=0x56;\nbuf[1]=0x00;\nbuf[2]=0x31;\nbuf[3]=0x05;\nbuf[4]=0x04;\nbuf[5]=0x01;\nbuf[6]=0x00;\nbuf[7]=0x19;\nbuf[8]=0x11;\n\n\nmsg.payload = buf;\nreturn msg;\n", "outputs": 1, "noerr": 0, "x": 570.75, "y": 462.75, "wires": [ [ "1cf2bee3.1e5c49" ] ] }, { "id": "f7617e71.67a7c", "type": "inject", "z": "26667300.231ed6", "name": "Set Resolution 320X240", "topic": "", "payload": "", "payloadType": "date", "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "x": 298.7499694824219, "y": 463.75, "wires": [ [ "8c7dc9b9.95e968" ] ] }, { "id": "f193eff8.49d278", "type": "function", "z": "26667300.231ed6", "name": "送信コマンド", "func": "var buf = new Buffer(9); \n\nbuf[0]=0x56;\nbuf[1]=0x00;\nbuf[2]=0x31;\nbuf[3]=0x05;\nbuf[4]=0x04;\nbuf[5]=0x01;\nbuf[6]=0x00;\nbuf[7]=0x19;\nbuf[8]=0x00;\n\nmsg.payload = buf;\nreturn msg;\n", "outputs": 1, "noerr": 0, "x": 567.75, "y": 524.75, "wires": [ [ "1cf2bee3.1e5c49" ] ] }, { "id": "9008a86b.6828a", "type": "inject", "z": "26667300.231ed6", "name": "Set Resolution 640x480", "topic": "", "payload": "", "payloadType": "date", "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "x": 308.7499694824219, "y": 524.75, "wires": [ [ "f193eff8.49d278" ] ] }, { "id": "6d650f41.394648", "type": "comment", "z": "26667300.231ed6", "name": "PTC06 Default:115200bps", "info": "", "x": 688.86669921875, "y": 164.5, "wires": [] }, { "id": "897339f0.da605", "type": "comment", "z": "26667300.231ed6", "name": "Reset is required to make the command effective.", "info": "", "x": 367.75, "y": 416.75, "wires": [] }, { "id": "8f5e9604.577aa", "type": "switch", "z": "26667300.231ed6", "name": "i>8)&0xFF);\nvar start_low = (start&0xFF);\n\nvar len_high = ((block>>8)&0xFF);\nvar len_low = (block&0xFF);\n\nbuf[0] =0x56;\nbuf[1] =0x00;\nbuf[2] =0x32;\nbuf[3] =0x0C;\nbuf[4] =0x00;\nbuf[5] =0x0A;\nbuf[6] =0x00;\nbuf[7] =0x00;\nbuf[8] =start_high;\nbuf[9] =start_low;\nbuf[10]=0x00;\nbuf[11]=0x00;\nbuf[12]=len_high;\nbuf[13]=len_low;\nbuf[14]=0x00;\nbuf[15]=0x0A;\n\nmsg.payload = buf;\nreturn msg;", "outputs": 1, "noerr": 0, "x": 652.3332824707031, "y": 980.8333129882812, "wires": [ [ "367fdce.045d0a4" ] ] }, { "id": "367fdce.045d0a4", "type": "serial request", "z": "26667300.231ed6", "name": "", "serial": "7b1a2a97.73a96c", "x": 811.333251953125, "y": 981.3333129882812, "wires": [ [ "31d6f601.040092", "1b9a79ab.6ba406" ] ] }, { "id": "1b9a79ab.6ba406", "type": "function", "z": "26667300.231ed6", "name": "変換", "func": "var size = global.get(\"SerialCameraFileSize\");\nvar loop = global.get(\"LOOP_i\");\nvar block = global.get(\"SerialCameraFileBlockSize\");\nvar buf = new Buffer(block); \n\nif( msg.payload[0]==0x76 && msg.payload[2]==0x32 )\n{\n for(var i=0; i>8)&0xFF);\nvar start_low=(start&0xFF);\n\nvar len_high=((size>>8)&0xFF);\nvar len_low=(size&0xFF);\n\nbuf[0] =0x56;\nbuf[1] =0x00;\nbuf[2] =0x32;\nbuf[3] =0x0C;\nbuf[4] =0x00;\nbuf[5] =0x0A;\nbuf[6] =0x00;\nbuf[7] =0x00;\nbuf[8] =start_high;\nbuf[9] =start_low;\nbuf[10]=0x00;\nbuf[11]=0x00;\nbuf[12]=len_high;\nbuf[13]=len_low;\nbuf[14]=0x00;\nbuf[15]=0x0A;\n\nmsg.payload = buf;\nreturn msg;\n", "outputs": 1, "noerr": 0, "x": 330.949951171875, "y": 1160.066650390625, "wires": [ [ "8e67e91a.7d173" ] ] }, { "id": "19f4e155.7c018f", "type": "file", "z": "26667300.231ed6", "name": "Jpeg File Delete", "filename": "img.jpg", "appendNewline": true, "createDir": true, "overwriteFile": "delete", "encoding": "none", "x": 435.566650390625, "y": 774.566650390625, "wires": [ [] ] }, { "id": "d8c89f4e.af91a8", "type": "template", "z": "26667300.231ed6", "name": "End", "field": "payload", "fieldType": "msg", "format": "handlebars", "syntax": "mustache", "template": "Get Image End", "x": 847.300048828125, "y": 1249.7666015625, "wires": [ [ "7ca90933.da93d" ] ] }, { "id": "2b62ebc5.caf86c", "type": "function", "z": "26667300.231ed6", "name": "i/total", "func": "var i= global.get(\"LOOP_i\");\nvar loop=global.get(\"SerialCameraLoopSize\");\nvar buff = i+\"回/全\" + Math.round(loop) +\"回\";\nmsg.payload=buff;\nreturn msg;", "outputs": 1, "noerr": 0, "x": 1066.1998901367188, "y": 930.5665893554688, "wires": [ [ "1caaef34.262f11" ] ] }, { "id": "5150bd91.d6e684", "type": "comment", "z": "26667300.231ed6", "name": "File is created in the node-red root directry", "info": "", "x": 1119, "y": 1160.25, "wires": [] }, { "id": "7b1a2a97.73a96c", "type": "serial-port", "z": "", "serialport": "COM7", "serialbaud": "115200", "databits": "8", "parity": "none", "stopbits": "1", "waitfor": "", "dtr": "none", "rts": "none", "cts": "none", "dsr": "none", "newline": "30", "bin": "bin", "out": "time", "addchar": "", "responsetimeout": "20000" } ]