Created
January 8, 2020 21:38
-
-
Save jimwhitfield/214622290b84b8ee3621025b506ce3d4 to your computer and use it in GitHub Desktop.
NodeRed flow to use ttyACM0 and play a sound on data swing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"id": "6bf977c3.4c5c68", | |
"type": "tab", | |
"label": "OPS24--A", | |
"disabled": false, | |
"info": "" | |
}, | |
{ | |
"id": "6b995d18.2cd584", | |
"type": "serial in", | |
"z": "6bf977c3.4c5c68", | |
"name": "ttyACM0", | |
"serial": "4c935400.208c2c", | |
"x": 83, | |
"y": 107, | |
"wires": [ | |
[ | |
"7389d9f2.c7e6c8", | |
"72083498.6b4e9c" | |
] | |
] | |
}, | |
{ | |
"id": "6abebb15.ad3894", | |
"type": "serial out", | |
"z": "6bf977c3.4c5c68", | |
"name": "Send to OPS24--A", | |
"serial": "4c935400.208c2c", | |
"x": 407, | |
"y": 54, | |
"wires": [] | |
}, | |
{ | |
"id": "e02a9fc2.3ac7f", | |
"type": "inject", | |
"z": "6bf977c3.4c5c68", | |
"name": "send OJ to switch to JSON", | |
"topic": "", | |
"payload": "OJ", | |
"payloadType": "str", | |
"repeat": "", | |
"crontab": "", | |
"once": true, | |
"x": 163, | |
"y": 55, | |
"wires": [ | |
[ | |
"6abebb15.ad3894" | |
] | |
] | |
}, | |
{ | |
"id": "7389d9f2.c7e6c8", | |
"type": "json", | |
"z": "6bf977c3.4c5c68", | |
"name": "", | |
"property": "payload", | |
"action": "", | |
"pretty": false, | |
"x": 250, | |
"y": 100, | |
"wires": [ | |
[ | |
"aa72ba64.661cc8", | |
"7d2cc775.5fd958" | |
] | |
] | |
}, | |
{ | |
"id": "d5c10a8c.ee49d8", | |
"type": "rbe", | |
"z": "6bf977c3.4c5c68", | |
"name": "", | |
"func": "deadbandEq", | |
"gap": "4", | |
"start": "", | |
"inout": "in", | |
"property": "payload", | |
"x": 320, | |
"y": 262, | |
"wires": [ | |
[ | |
"83b9400b.f563b" | |
] | |
] | |
}, | |
{ | |
"id": "53c487eb.c44a78", | |
"type": "change", | |
"z": "6bf977c3.4c5c68", | |
"name": "", | |
"rules": [ | |
{ | |
"t": "set", | |
"p": "payload", | |
"pt": "msg", | |
"to": "payload.speed", | |
"tot": "msg" | |
} | |
], | |
"action": "", | |
"property": "", | |
"from": "", | |
"to": "", | |
"reg": false, | |
"x": 431, | |
"y": 186, | |
"wires": [ | |
[ | |
"d5c10a8c.ee49d8" | |
] | |
] | |
}, | |
{ | |
"id": "83b9400b.f563b", | |
"type": "file in", | |
"z": "6bf977c3.4c5c68", | |
"name": "", | |
"filename": "sound_recordings\\buzz-short.wav", | |
"format": "", | |
"x": 458, | |
"y": 321, | |
"wires": [ | |
[ | |
"1bc3f198.60f8de" | |
] | |
] | |
}, | |
{ | |
"id": "1bc3f198.60f8de", | |
"type": "play audio", | |
"z": "6bf977c3.4c5c68", | |
"name": "", | |
"voice": "", | |
"x": 897, | |
"y": 326, | |
"wires": [] | |
}, | |
{ | |
"id": "aa72ba64.661cc8", | |
"type": "switch", | |
"z": "6bf977c3.4c5c68", | |
"name": "if speed contains number", | |
"property": "payload.speed", | |
"propertyType": "msg", | |
"rules": [ | |
{ | |
"t": "cont", | |
"v": "", | |
"vt": "num" | |
} | |
], | |
"checkall": "true", | |
"repair": false, | |
"outputs": 1, | |
"x": 214, | |
"y": 185, | |
"wires": [ | |
[ | |
"53c487eb.c44a78" | |
] | |
] | |
}, | |
{ | |
"id": "6d309db9.95ecd4", | |
"type": "comment", | |
"z": "6bf977c3.4c5c68", | |
"name": "multi-case switch on msg contents", | |
"info": "add a new flow for each if foo contains string for each type\nFor instance, \nif msg.error contains string, log it.\nif msg.Units contains string, show it as the unit label\nif msg.Product contains string, show it.", | |
"x": 208, | |
"y": 147, | |
"wires": [] | |
}, | |
{ | |
"id": "7d2cc775.5fd958", | |
"type": "switch", | |
"z": "6bf977c3.4c5c68", | |
"name": "if Product contains string", | |
"property": "payload.Product", | |
"propertyType": "msg", | |
"rules": [ | |
{ | |
"t": "cont", | |
"v": "OPS", | |
"vt": "str" | |
} | |
], | |
"checkall": "true", | |
"repair": false, | |
"outputs": 1, | |
"x": 209, | |
"y": 401, | |
"wires": [ | |
[ | |
"4b6a70b7.a0da6" | |
] | |
] | |
}, | |
{ | |
"id": "4b6a70b7.a0da6", | |
"type": "debug", | |
"z": "6bf977c3.4c5c68", | |
"name": "Display Product", | |
"active": true, | |
"tosidebar": true, | |
"console": true, | |
"tostatus": false, | |
"complete": "payload.Product", | |
"targetType": "msg", | |
"x": 250, | |
"y": 480, | |
"wires": [] | |
}, | |
{ | |
"id": "8fba3f74.696cc", | |
"type": "serial out", | |
"z": "6bf977c3.4c5c68", | |
"name": "Send to OPS24--A", | |
"serial": "4c935400.208c2c", | |
"x": 849, | |
"y": 118, | |
"wires": [] | |
}, | |
{ | |
"id": "dc363831.eff538", | |
"type": "inject", | |
"z": "6bf977c3.4c5c68", | |
"name": "send Product Query", | |
"topic": "", | |
"payload": "?P", | |
"payloadType": "str", | |
"repeat": "", | |
"crontab": "", | |
"once": false, | |
"x": 644, | |
"y": 117, | |
"wires": [ | |
[ | |
"8fba3f74.696cc" | |
] | |
] | |
}, | |
{ | |
"id": "f34e8341.920d6", | |
"type": "comment", | |
"z": "6bf977c3.4c5c68", | |
"name": "A trivial \"command\" to ask for the Product name", | |
"info": "This is a trivial \"command\" to ask for the Product name\nNotice that there is a switch node that recognizes the \"Product\" message and logs it", | |
"x": 713, | |
"y": 74, | |
"wires": [] | |
}, | |
{ | |
"id": "5c5678e7.0151a8", | |
"type": "comment", | |
"z": "6bf977c3.4c5c68", | |
"name": "A trivial flow node that will display the product information if it is received.", | |
"info": "", | |
"x": 360, | |
"y": 363, | |
"wires": [] | |
}, | |
{ | |
"id": "72083498.6b4e9c", | |
"type": "debug", | |
"z": "6bf977c3.4c5c68", | |
"name": "", | |
"active": false, | |
"tosidebar": true, | |
"console": true, | |
"tostatus": false, | |
"complete": "true", | |
"targetType": "full", | |
"x": 110, | |
"y": 240, | |
"wires": [] | |
}, | |
{ | |
"id": "4c935400.208c2c", | |
"type": "serial-port", | |
"z": "", | |
"serialport": "/dev/ttyACM0", | |
"serialbaud": "19200", | |
"databits": "8", | |
"parity": "none", | |
"stopbits": "1", | |
"waitfor": "", | |
"newline": "\\n", | |
"bin": "false", | |
"out": "char", | |
"addchar": "", | |
"responsetimeout": "10000" | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment