Skip to content

Instantly share code, notes, and snippets.

@PatchworkBoy
Last active December 8, 2016 22:11
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 PatchworkBoy/cdd3890508a19fa01504a30a870a84f9 to your computer and use it in GitHub Desktop.
Save PatchworkBoy/cdd3890508a19fa01504a30a870a84f9 to your computer and use it in GitHub Desktop.
Pololu DRV8835 2ch PWM DC Motor Controller (Raspberry Pi)
[
{
"id": "79ea8e00.7cd484",
"type": "ui_slider",
"z": "a7216b4a.a1fcd",
"tab": "9cfc2f36.2694a8",
"name": "Speed",
"topic": "m1",
"group": "Motor 1",
"order": 1,
"min": 0,
"max": "480",
"x": 810,
"y": 260,
"wires": [
[
"b481c365.4a42f",
"3dc20b3e.fe5d14"
]
]
},
{
"id": "f889fc69.10b538",
"type": "ui_slider",
"z": "a7216b4a.a1fcd",
"tab": "9cfc2f36.2694a8",
"name": "Speed",
"topic": "m2",
"group": "Motor 2",
"order": 1,
"min": 0,
"max": "480",
"x": 810,
"y": 400,
"wires": [
[
"a03df7dc.38827",
"dde030f6.7ad65"
]
]
},
{
"id": "647df633.d2cba",
"type": "ui_switch",
"z": "a7216b4a.a1fcd",
"tab": "9cfc2f36.2694a8",
"name": "Direction",
"topic": "",
"group": "Motor 1",
"order": 1,
"onvalue": "1",
"offvalue": "0",
"x": 280,
"y": 300,
"wires": [
[
"2edc04b.5fa487c"
]
]
},
{
"id": "45b2b096.767608",
"type": "ui_switch",
"z": "a7216b4a.a1fcd",
"tab": "9cfc2f36.2694a8",
"name": "Direction",
"topic": "",
"group": "Motor 2",
"order": 1,
"onvalue": "1",
"offvalue": "0",
"x": 280,
"y": 440,
"wires": [
[
"ef9e9962.a8354"
]
]
},
{
"id": "2edc04b.5fa487c",
"type": "rpi-gpio out",
"z": "a7216b4a.a1fcd",
"name": "Motor 1 Direction",
"pin": "29",
"set": true,
"level": "1",
"out": "out",
"x": 1090,
"y": 300,
"wires": []
},
{
"id": "ef9e9962.a8354",
"type": "rpi-gpio out",
"z": "a7216b4a.a1fcd",
"name": "Motor 2 Direction",
"pin": "31",
"set": true,
"level": "1",
"out": "out",
"x": 1090,
"y": 440,
"wires": []
},
{
"id": "c4ce2cdb.917fa",
"type": "inject",
"z": "a7216b4a.a1fcd",
"name": "Init 1",
"topic": "",
"payload": "1",
"payloadType": "num",
"repeat": "",
"crontab": "",
"once": true,
"x": 90,
"y": 380,
"wires": [
[
"45b2b096.767608",
"647df633.d2cba",
"fb5ed58c.1458d8",
"f800ca94.eb7e"
]
]
},
{
"id": "b481c365.4a42f",
"type": "function",
"z": "a7216b4a.a1fcd",
"name": "Motor 1 Speed",
"func": "var pin = 26;\nvar wpi = context.global.wpi;\nwpi.wiringPiSetup();\nwpi.pinMode(pin, wpi.PWM_OUTPUT);\nwpi.pwmSetMode(wpi.PWM_MODE_MS);\nwpi.pwmSetRange(480);\nwpi.pwmSetClock(2);\nif(msg.payload){\n wpi.pwmWrite(pin, parseInt(msg.payload));\n} else {\n wpi.pwmWrite(pin, 0);\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 1080,
"y": 260,
"wires": [
[]
]
},
{
"id": "a03df7dc.38827",
"type": "function",
"z": "a7216b4a.a1fcd",
"name": "Motor 2 Speed",
"func": "var pin2 = 23;\nvar wpi = context.global.wpi;\nwpi.wiringPiSetup();\nwpi.pinMode(pin2, wpi.PWM_OUTPUT);\nwpi.pwmSetMode(wpi.PWM_MODE_MS);\nwpi.pwmSetRange(480);\nwpi.pwmSetClock(2);\nif(msg.payload){\n wpi.pwmWrite(pin2, parseInt(msg.payload));\n} else {\n wpi.pwmWrite(pin2, 0);\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 1080,
"y": 400,
"wires": [
[]
]
},
{
"id": "dde030f6.7ad65",
"type": "ui_chart",
"z": "a7216b4a.a1fcd",
"tab": "9cfc2f36.2694a8",
"name": "Motor 2 (Y / Alt / DEC)",
"group": "History",
"order": 1,
"interpolate": "basis",
"nodata": "No Data",
"removeOlder": 1,
"removeOlderUnit": "60",
"x": 1100,
"y": 360,
"wires": [
[],
[]
]
},
{
"id": "3dc20b3e.fe5d14",
"type": "ui_chart",
"z": "a7216b4a.a1fcd",
"tab": "9cfc2f36.2694a8",
"name": "Motor 1 (X / Az / RA)",
"group": "History",
"order": 1,
"interpolate": "basis",
"nodata": "No Data",
"removeOlder": 1,
"removeOlderUnit": "60",
"x": 1100,
"y": 220,
"wires": [
[],
[]
]
},
{
"id": "9cfc2f36.2694a8",
"type": "ui_tab",
"z": "",
"name": "Home",
"icon": "dashboard",
"order": "1"
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment