Skip to content

Instantly share code, notes, and snippets.

@jimwhitfield
Created May 7, 2017 04:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jimwhitfield/fc83386c7a61f9ae42155344f0eaa538 to your computer and use it in GitHub Desktop.
Save jimwhitfield/fc83386c7a61f9ae42155344f0eaa538 to your computer and use it in GitHub Desktop.
A NodeRed flow that reads from the OPS241 and plays a wav file if over the speed threshold
[
{
"id": "8eb36c95.abf588",
"type": "exec",
"z": "bb84ba45.9732b8",
"command": "/usr/bin/aplay",
"addpay": false,
"append": "/home/pi/SlowDown1s.wav",
"useSpawn": "",
"timer": "",
"name": "",
"x": 167,
"y": 250.5,
"wires": [
[],
[],
[]
]
},
{
"id": "66e106f3.5a02f",
"type": "switch",
"z": "bb84ba45.9732b8",
"name": "test for slow/fast",
"property": "n",
"propertyType": "msg",
"rules": [
{
"t": "btwn",
"v": "-1.1",
"vt": "num",
"v2": "1.1",
"v2t": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"outputs": 2,
"x": 184,
"y": 177,
"wires": [
[],
[
"8eb36c95.abf588"
]
]
},
{
"id": "9562dcbd.8b0808",
"type": "function",
"z": "bb84ba45.9732b8",
"name": "parseFloat into msg.n",
"func": "\nvar rtn = {n:0.0};\nrtn.n = parseFloat(msg.payload);\n\nreturn rtn;\n",
"outputs": 1,
"noerr": 0,
"x": 177,
"y": 97,
"wires": [
[
"66e106f3.5a02f"
]
]
},
{
"id": "78e5daad.343f6c",
"type": "serial in",
"z": "bb84ba45.9732b8",
"name": "OPS241",
"serial": "9cddaefc.b7137",
"x": 96,
"y": 41,
"wires": [
[
"9562dcbd.8b0808"
]
]
},
{
"id": "9cddaefc.b7137",
"type": "serial-port",
"z": "",
"serialport": "/dev/ttyACM0",
"serialbaud": "9600",
"databits": "8",
"parity": "none",
"stopbits": "1",
"newline": "\\n",
"bin": "false",
"out": "char",
"addchar": false
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment