{ "blocks": [ { "_containsChildrenIds": [], "icon": "fa-cogs", "flags": 0, "name": "Set GPIO Mode", "group": "basic", "variables": "{\"GPIO\":\"_gpio\",\"GPIO_MODE\":\"_mode\"}", "send": "setMode {{GPIO}} {{GPIO_MODE}}", "_isGPIO": true, "_gpioFunc": "setMode", "description": "Sets the GPIO mode", "id": "ebed6e03-999b-54d5-eb88-4940dbe81533", "declaredClass": "xcf.model.Command", "startup": true, "interval": "0", "outlet": 0, "enabled": true, "shareTitle": "", "order": 0, "type": "added", "_gpio": "17", "_mode": "1" }, { "_containsChildrenIds": [], "icon": "fa-send", "flags": 0, "name": "Digital Write", "group": "basic", "variables": "{\"GPIO\":\"_gpio\",\"GPIO_VALUE\":\"_value\"}", "send": "digitalWrite {{GPIO}} {{GPIO_VALUE}}", "_isGPIO": true, "_gpioFunc": "digitalWrite", "description": "Sets the GPIO level to 0 or 1. If PWM or servo pulses are active on the GPIO they are switched off.", "id": "5d6c1752-b25c-8797-fe5d-e1f566bde2af", "declaredClass": "xcf.model.Command", "startup": false, "interval": 0, "outlet": 0, "enabled": true, "shareTitle": "", "order": 0, "type": "added", "_gpio": "18", "_value": "1" }, { "_containsChildrenIds": [], "icon": "fa-send", "flags": 0, "name": "Digital Write", "group": "basic", "variables": "{\"GPIO\":\"_gpio\",\"GPIO_VALUE\":\"_value\"}", "send": "digitalWrite {{GPIO}} {{GPIO_VALUE}}", "_isGPIO": true, "_gpioFunc": "digitalWrite", "description": "Sets the GPIO level to 0 or 1. If PWM or servo pulses are active on the GPIO they are switched off.", "id": "03439381-7f68-03cb-f617-70e03b149b97", "declaredClass": "xcf.model.Command", "startup": false, "interval": 0, "outlet": 0, "enabled": true, "shareTitle": "", "order": 0, "type": "added", "_gpio": "18", "_value": "0" }, { "_containsChildrenIds": [ "items" ], "icon": "fa-send", "flags": 32768, "name": "Digital Read", "group": "basic", "variables": "{\"GPIO\":\"_gpio\"}", "send": "digitalRead {{GPIO}}", "_isGPIO": true, "_gpioFunc": "digitalRead", "description": "Returns the GPIO level", "id": "c57624ed-8818-fcb6-cb2a-1356efcefc4a", "declaredClass": "xcf.model.Command", "startup": false, "interval": "0", "outlet": 0, "enabled": true, "shareTitle": "", "order": 0, "type": "added", "_gpio": "18", "items": [ "0eca6275-b17b-c279-0316-477f3485925f" ] }, { "_containsChildrenIds": [], "parentId": "c57624ed-8818-fcb6-cb2a-1356efcefc4a", "id": "0eca6275-b17b-c279-0316-477f3485925f", "declaredClass": "xblox.model.code.RunScript", "name": "Run Script", "method": "this.setVariable(\"GPIO - \"+arguments[0].gpio,arguments[0].value);", "args": "", "deferred": false, "icon": "fa-code", "outlet": 8, "enabled": true, "shareTitle": "", "order": 0, "type": "added", "description": "No Description" }, { "_containsChildrenIds": [], "name": "GPIO - 18", "group": "basicVariables", "id": "92cae109-c27a-0d8a-9aac-2eb3a1602fb4", "declaredClass": "xcf.model.Variable", "gui": "off", "cmd": "off", "save": false, "target": "None", "value": 0, "register": true, "readOnly": false, "isVariable": true, "flags": 4096, "outlet": 0, "enabled": true, "shareTitle": "", "description": "No Description", "order": 0, "type": "added", "icon": "fa-play" }, { "_containsChildrenIds": [ "items" ], "group": "basic", "id": "09ef16ec-e764-906f-3ceb-cdbd90b2e110", "items": [ "5fe48c36-18ce-6309-270a-a9a04bd64f92" ], "declaredClass": "xcf.model.Command", "startup": false, "send": "", "name": "Blink", "interval": 0, "flags": 2048, "icon": "fa-exclamation", "outlet": 0, "enabled": true, "shareTitle": "", "description": "No Description", "order": 0, "type": "added" }, { "_containsChildrenIds": [ "items" ], "initial": "1", "comparator": "<=", "final": "5", "modifier": "+1", "counterName": "value", "parentId": "09ef16ec-e764-906f-3ceb-cdbd90b2e110", "id": "5fe48c36-18ce-6309-270a-a9a04bd64f92", "items": [ "4e05a2c6-653f-e75f-dcf1-e6095275d854", "f41c70d6-5d18-6c17-3e3d-f9ec34594ee3" ], "declaredClass": "xblox.model.loops.ForBlock", "name": "For", "icon": "", "ignoreErrors": false, "_currentForIndex": 6, "_forState": false, "outlet": 0, "enabled": true, "shareTitle": "", "description": "No Description", "order": 0, "type": "added" }, { "_containsChildrenIds": [], "icon": "fa-send", "flags": 0, "name": "Digital Write", "variables": "{\"GPIO\":\"_gpio\",\"GPIO_VALUE\":\"_value\"}", "send": "digitalWrite {{GPIO}} {{GPIO_VALUE}}", "_isGPIO": true, "_gpioFunc": "digitalWrite", "description": "Sets the GPIO level to 0 or 1. If PWM or servo pulses are active on the GPIO they are switched off.", "id": "4e05a2c6-653f-e75f-dcf1-e6095275d854", "declaredClass": "xcf.model.Command", "startup": false, "interval": 0, "outlet": 0, "enabled": true, "shareTitle": "", "order": 0, "type": "added", "_gpio": "18", "_value": "1", "parentId": "5fe48c36-18ce-6309-270a-a9a04bd64f92" }, { "_containsChildrenIds": [], "icon": "fa-send", "flags": 0, "name": "Digital Write", "variables": "{\"GPIO\":\"_gpio\",\"GPIO_VALUE\":\"_value\"}", "send": "digitalWrite {{GPIO}} {{GPIO_VALUE}}", "_isGPIO": true, "_gpioFunc": "digitalWrite", "description": "Sets the GPIO level to 0 or 1. If PWM or servo pulses are active on the GPIO they are switched off.", "id": "f41c70d6-5d18-6c17-3e3d-f9ec34594ee3", "declaredClass": "xcf.model.Command", "startup": false, "interval": 0, "outlet": 0, "enabled": true, "shareTitle": "", "order": 0, "type": "added", "_gpio": "18", "_value": "0", "parentId": "5fe48c36-18ce-6309-270a-a9a04bd64f92" }, { "_containsChildrenIds": [ "items" ], "icon": "fa-send", "flags": 0, "name": "Get PWM Duty Cycle", "group": "basic", "variables": "{\"GPIO\":\"_gpio\"}", "send": "getPwmDutyCycle {{GPIO}}", "_isGPIO": true, "_gpioFunc": "pwmWrite", "description": "Returns the PWM duty cycle setting on the GPIO.", "id": "4afe9101-2c66-cde6-a8bc-ed7c8b2a0296", "items": [ "5b4cc5ad-74e1-1676-6119-2879c1acc852" ], "declaredClass": "xcf.model.Command", "startup": false, "interval": "0", "outlet": 0, "enabled": true, "shareTitle": "", "order": 0, "type": "added", "_gpio": "18", "_value": "1" }, { "_containsChildrenIds": [], "parentId": "4afe9101-2c66-cde6-a8bc-ed7c8b2a0296", "id": "5b4cc5ad-74e1-1676-6119-2879c1acc852", "declaredClass": "xblox.model.code.RunScript", "name": "Run Script", "method": "console.log('getPwmDutyCycle',arguments);", "args": "", "deferred": false, "icon": "fa-code", "outlet": 8, "enabled": true, "shareTitle": "", "order": 0, "type": "added", "description": "No Description" }, { "_containsChildrenIds": [ "items" ], "icon": "fa-send", "flags": 0, "name": "Get PWM Range", "group": "basic", "variables": "{\"GPIO\":\"_gpio\",\"RANGE\":\"_range\"}", "send": "getPwmRange {{GPIO}}", "_isGPIO": true, "_gpioFunc": "getPwmRange", "description": "Returns the duty cycle range used for the GPIO. If hardware PWM is active on the GPIO the reported range will be 1000000.", "id": "ad989d6b-f8be-9da0-fe51-3f368549eaf1", "items": [ "7c6fa262-7f74-1e76-4614-baa4ed4eed81" ], "declaredClass": "xcf.model.Command", "startup": false, "interval": 0, "outlet": 0, "enabled": true, "shareTitle": "", "order": 0, "type": "added", "_gpio": "17" }, { "_containsChildrenIds": [], "parentId": "ad989d6b-f8be-9da0-fe51-3f368549eaf1", "id": "7c6fa262-7f74-1e76-4614-baa4ed4eed81", "declaredClass": "xblox.model.code.RunScript", "name": "Run Script", "method": "console.log('getPwmRange',arguments);", "args": "", "deferred": false, "icon": "fa-code", "outlet": 8, "enabled": true, "shareTitle": "", "order": 0, "type": "added", "description": "No Description" }, { "_containsChildrenIds": [], "icon": "fa-send", "flags": 0, "name": "Servo Write", "variables": "{\"GPIO\":\"_gpio\",\"PULSEW\":\"_pulse\"}", "send": "servoWrite {{GPIO}} {{PULSEW}}", "_isGPIO": true, "_gpioFunc": "servoWrite", "description": "Starts servo pulses at 50Hz on the GPIO, 0 (off), 500 (most anti-clockwise) to 2500 (most clockwise).
pulseWidth - pulse width in microseconds, an unsigned integer, 0 or a number in the range 500 through 2500", "id": "a0ce241e-7bab-284e-34cc-11256518c1c7", "declaredClass": "xcf.model.Command", "startup": false, "interval": "0", "outlet": 0, "enabled": true, "shareTitle": "", "order": 0, "type": "added", "_gpio": "18", "_pulse": "1300", "group": "basic" }, { "_containsChildrenIds": [ "items" ], "icon": "fa-send", "flags": 32768, "name": "Enable Alert", "group": "basic", "variables": "{\"GPIO\":\"_gpio\"}", "send": "enableAlert {{GPIO}}", "_isGPIO": true, "_gpioFunc": "enableAlert", "description": "Enables alerts for the GPIO. An alert event will be emitted every time the GPIO changes state.Add a block of type finish to retrieve the even values.", "id": "707af144-4dea-4d2d-62a5-b3ad9bb8cc88", "items": [ "e47d30fa-b474-323d-bd20-65f876bf1ee6" ], "declaredClass": "xcf.model.Command", "startup": false, "interval": "0", "outlet": 0, "enabled": true, "shareTitle": "", "order": 0, "type": "added", "_gpio": "18" }, { "_containsChildrenIds": [], "parentId": "707af144-4dea-4d2d-62a5-b3ad9bb8cc88", "id": "e47d30fa-b474-323d-bd20-65f876bf1ee6", "declaredClass": "xblox.model.code.RunScript", "name": "Run Script", "method": "console.log('alert');", "args": "", "deferred": false, "icon": "fa-code", "outlet": 8, "enabled": true, "shareTitle": "", "order": 0, "type": "added", "description": "No Description" }, { "_containsChildrenIds": [ "items" ], "group": "basic", "id": "23a14eb0-dae0-1c7b-4c0d-fea0970f9e8c", "items": [ "74f9dadb-0d8c-20b8-8f23-4f38a01dea50", "5dbf7c20-5eaf-e393-4034-b0afdd6db9b1", "14810b92-5497-771f-00e0-bab445c612ab", "5738cbd3-6c97-39e1-74e7-e0ce08864a64" ], "declaredClass": "xcf.model.Command", "startup": true, "send": "", "name": "Servo-Test", "interval": "0", "flags": 2048, "icon": "fa-exclamation", "outlet": 0, "enabled": true, "shareTitle": "", "description": "No Description", "order": 0, "type": "added" }, { "_containsChildrenIds": [], "icon": "fa-cogs", "flags": 0, "name": "Set GPIO Mode", "variables": "{\"GPIO\":\"_gpio\",\"GPIO_MODE\":\"_mode\"}", "send": "setMode {{GPIO}} {{GPIO_MODE}}", "_isGPIO": true, "_gpioFunc": "setMode", "description": "Sets the GPIO mode", "parentId": "23a14eb0-dae0-1c7b-4c0d-fea0970f9e8c", "id": "74f9dadb-0d8c-20b8-8f23-4f38a01dea50", "declaredClass": "xcf.model.Command", "startup": false, "interval": "0", "outlet": 0, "enabled": true, "shareTitle": "", "order": 0, "type": "added", "_gpio": "18", "_mode": "1" }, { "_containsChildrenIds": [], "icon": "fa-send", "flags": 34816, "name": "Servo Write", "variables": "{\"GPIO\":\"_gpio\",\"PULSEW\":\"_pulse\"}", "send": "return \"servoWrite 18 \" + this.getVariable(\"Next Servo Pulse\");", "_isGPIO": true, "_gpioFunc": "servoWrite", "description": "Starts servo pulses at 50Hz on the GPIO, 0 (off), 500 (most anti-clockwise) to 2500 (most clockwise).
pulseWidth - pulse width in microseconds, an unsigned integer, 0 or a number in the range 500 through 2500", "parentId": "23a14eb0-dae0-1c7b-4c0d-fea0970f9e8c", "id": "5dbf7c20-5eaf-e393-4034-b0afdd6db9b1", "declaredClass": "xcf.model.Command", "startup": false, "interval": "0", "outlet": 0, "enabled": false, "shareTitle": "", "order": 0, "type": "added", "_gpio": "18", "_pulse": "1200" }, { "_containsChildrenIds": [], "name": "Next Servo Pulse", "group": "basicVariables", "id": "85365eb1-27f4-9f35-36f3-f94709996f0f", "declaredClass": "xcf.model.Variable", "gui": "off", "cmd": "off", "save": false, "target": "None", "value": "2000", "register": true, "readOnly": false, "isVariable": true, "flags": 4096, "outlet": 0, "enabled": true, "shareTitle": "", "description": "No Description", "order": 0, "type": "added", "icon": "fa-play" }, { "_containsChildrenIds": [], "icon": "fa-send", "flags": 0, "name": "Servo Write", "variables": "{\"GPIO\":\"_gpio\",\"PULSEW\":\"_pulse\"}", "send": "servoWrite {{GPIO}} {{PULSEW}}", "_isGPIO": true, "_gpioFunc": "servoWrite", "description": "Starts servo pulses at 50Hz on the GPIO, 0 (off), 500 (most anti-clockwise) to 2500 (most clockwise).
pulseWidth - pulse width in microseconds, an unsigned integer, 0 or a number in the range 500 through 2500", "parentId": "23a14eb0-dae0-1c7b-4c0d-fea0970f9e8c", "id": "14810b92-5497-771f-00e0-bab445c612ab", "declaredClass": "xcf.model.Command", "startup": false, "interval": "0", "outlet": 0, "enabled": true, "shareTitle": "", "order": 0, "type": "added", "_gpio": "18", "_pulse": "1300" }, { "_containsChildrenIds": [], "icon": "fa-send", "flags": 0, "name": "Servo Write", "variables": "{\"GPIO\":\"_gpio\",\"PULSEW\":\"_pulse\"}", "send": "servoWrite {{GPIO}} {{PULSEW}}", "_isGPIO": true, "_gpioFunc": "servoWrite", "description": "Starts servo pulses at 50Hz on the GPIO, 0 (off), 500 (most anti-clockwise) to 2500 (most clockwise).
pulseWidth - pulse width in microseconds, an unsigned integer, 0 or a number in the range 500 through 2500", "id": "5738cbd3-6c97-39e1-74e7-e0ce08864a64", "declaredClass": "xcf.model.Command", "startup": false, "interval": "0", "outlet": 0, "enabled": true, "shareTitle": "", "order": 0, "type": "added", "_gpio": "18", "_pulse": "[Next Servo Pulse]", "parentId": "23a14eb0-dae0-1c7b-4c0d-fea0970f9e8c" }, { "_containsChildrenIds": [], "icon": "fa-send", "flags": 0, "name": "Update Servo", "group": "basic", "variables": "{\"GPIO\":\"_gpio\",\"PULSEW\":\"_pulse\"}", "send": "servoWrite {{GPIO}} {{PULSEW}}", "_isGPIO": true, "_gpioFunc": "servoWrite", "description": "Starts servo pulses at 50Hz on the GPIO, 0 (off), 500 (most anti-clockwise) to 2500 (most clockwise).
pulseWidth - pulse width in microseconds, an unsigned integer, 0 or a number in the range 500 through 2500", "id": "8331247f-9606-7423-f8a4-77d91c9545b9", "declaredClass": "xcf.model.Command", "startup": false, "interval": "0", "outlet": 0, "enabled": true, "shareTitle": "", "order": 0, "type": "added", "_gpio": "18", "_pulse": "[SERVO_SLIDER]" }, { "_containsChildrenIds": [], "name": "SERVO_SLIDER", "group": "basicVariables", "id": "5868ef1a-cfa4-cb94-79f4-38a570458d14", "declaredClass": "xcf.model.Variable", "gui": "off", "cmd": "off", "save": false, "target": "None", "value": "1589", "register": true, "readOnly": false, "isVariable": true, "flags": 4096, "outlet": 0, "enabled": true, "shareTitle": "", "description": "No Description", "order": 0, "type": "added", "icon": "fa-play" } ], "variables": null }