Skip to content

Commit ce249f6

Browse files
committed
Fix markdown formatting of pasted in code
1 parent f64e5ef commit ce249f6

File tree

3 files changed

+27
-22
lines changed

3 files changed

+27
-22
lines changed

docs/hardware/arduino.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ to communicate with it.
2020
### Firmata
2121

2222
[Firmata](http://firmata.org/) is a protocol for communicating between an
23-
Arduino (as well as other microcontrollers) and the host computer, providing
23+
Arduino (as well as other microcontrollers) and the host computer, providing
2424
direct access to the IO pins.
2525

2626
#### Installation
2727

2828
First you need to load the default Firmata sketch onto the Arduino using the
29-
standard Arduino software download tools. This is usually found under
29+
standard Arduino software download tools. This is usually found under
3030
*Files - Examples - Firmata - Standard Firmata*.
3131

3232
To ensure you have the Arduino nodes in the Node-RED palette, install the
33-
firmata npm module and restart Node-RED
33+
firmata npm module and restart Node-RED
3434

3535
$ cd node-red
3636
$ npm install firmata
@@ -42,7 +42,9 @@ To run a "blink" flow that uses LED 13, copy the following flow and paste it
4242
into the Import Nodes dialog (*Import From - Clipboard* in the dropdown menu, or
4343
Ctrl-I). After clicking okay, click in the workspace to place the new nodes.
4444

45-
[{"id":"d7663aaf.47194","type":"arduino-board","repeat":"25","device":"/dev/ttyUSB0"},{"id":"8c09ca6c.a975d","type":"arduino out","name":"","pin":"13","state":"OUTPUT","arduino":"d7663aaf.47194","x":509.16667556762695,"y":162.16666984558105,"wires":[]},{"id":"e37b6a97.610968","type":"inject","name":"tick","topic":"","payload":"","repeat":"0.5","once":false,"x":116.16668319702148,"y":62.16666507720947,"wires":[["60b4aeaa.800d58"]]},{"id":"60b4aeaa.800d58","type":"function","name":"Toggle output on input","func":"\n// initialise level as a context variable if currently undefined \n// (context variables persist between calls to the function)\ncontext.level = context.level || false;\n\n// if it's a 0 make it a 1 else make it a 0...\ncontext.level = !context.level;\n\n// set the payload to the level and return\nmsg.payload = context.level;\nreturn msg;","outputs":1,"x":298.1666793823242,"y":113.16665458679199,"wires":[["8c09ca6c.a975d"]]}]
45+
````json
46+
[{"id":"d7663aaf.47194","type":"arduino-board","repeat":"25","device":"/dev/ttyUSB0"},{"id":"8c09ca6c.a975d","type":"arduino out","name":"","pin":"13","state":"OUTPUT","arduino":"d7663aaf.47194","x":509.16667556762695,"y":162.16666984558105,"wires":[]},{"id":"e37b6a97.610968","type":"inject","name":"tick","topic":"","payload":"","repeat":"0.5","once":false,"x":116.16668319702148,"y":62.16666507720947,"wires":[["60b4aeaa.800d58"]]},{"id":"60b4aeaa.800d58","type":"function","name":"Toggle output on input","func":"\n// initialise level as a context variable if currently undefined \n// (context variables persist between calls to the function)\ncontext.level = context.level || false;\n\n// if it's a 0 make it a 1 else make it a 0...\ncontext.level = !context.level;\n\n// set the payload to the level and return\nmsg.payload = context.level;\nreturn msg;","outputs":1,"x":298.1666793823242,"y":113.16665458679199,"wires":[["8c09ca6c.a975d"]]}]
47+
````
4648

4749
This flow is set to use `/dev/ttyUSB0`. If you need to change that, double click
4850
the node labelled `Pin 13` - the Arduino node. Click the pencil icon and change

docs/hardware/beagleboneblack.md

+9-8
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ layout: default
33
title: BeagleBone Black
44
---
55

6-
The BeagleBoneBlack already has node.js baked into it's default Angstrom OS, so
6+
The BeagleBoneBlack already has node.js baked into it's default Angstrom OS, so
77
some of these tips are optional.
88

99
#### Update node.js and bonescript (optional)
1010

1111
Log onto the BBB as root and at the prompt, run the following commands to ensure
12-
the everything is up to date.
12+
the everything is up to date.
1313

1414
$ opkg update
1515
$ opkg install nodejs bonescript
@@ -18,7 +18,7 @@ Whilst logged in, you may also want to install `screen` - a convenient way to
1818
run Node-RED in the console when not logged in.
1919

2020
$ opkg install screen
21-
21+
2222
#### Configuring Node-RED
2323

2424
There are not any specific nodes for the BBB. Instead, the `bonescript` module
@@ -27,7 +27,7 @@ can be made available for use in Function nodes.
2727
To do this, update `settings.js` to add the `bonescript` module to the
2828
Function global context:
2929

30-
functionGlobalContext: {
30+
functionGlobalContext: {
3131
bonescript: require('bonescript')
3232
}
3333

@@ -43,7 +43,9 @@ and paste it into the Import Nodes dialog (*Import From - Clipboard* in the
4343
dropdown menu, or Ctrl-I). After clicking okay, click in the workspace to place
4444
the new nodes.
4545

46-
[{"id":"b1fce44.9ce3c18","type":"inject","name":"on","topic":"","payload":"1","repeat":"","once":false,"x":127.16666412353516,"y":109.16666412353516,"wires":[["b2a66e5e.6da6f"]]},{"id":"591aef4d.b55f38","type":"inject","name":"off","topic":"","payload":"0","repeat":"","once":false,"x":127.16666412353516,"y":149.16666412353516,"wires":[["b2a66e5e.6da6f"]]},{"id":"36f2a960.164f76","type":"inject","name":"tick","topic":"","payload":"","repeat":"1","once":false,"x":127.16666412353516,"y":49.166664123535156,"wires":[["7ee460bc.df48e"]]},{"id":"55249ec9.21e61","type":"debug","name":"","active":true,"x":567.1666641235352,"y":89.16666412353516,"wires":[]},{"id":"7ee460bc.df48e","type":"function","name":"Toggle USR3 LED on input","func":"\nvar pin = \"USR3\"\nvar b = context.global.bonescript;\ncontext.state = context.state || b.LOW;\n\nb.pinMode(pin, b.OUTPUT);\n\n(context.state == b.LOW) ? context.state = b.HIGH : context.state = b.LOW;\nb.digitalWrite(pin, context.state);\n\nreturn msg;","outputs":1,"x":347.16666412353516,"y":69.16666412353516,"wires":[["55249ec9.21e61"]]},{"id":"b2a66e5e.6da6f","type":"function","name":"Set USR2 LED on input","func":"\nvar pin = \"USR2\";\nvar b = context.global.bonescript;\n\nb.pinMode(pin, b.OUTPUT);\n\nvar level = (msg.payload === \"1\")?1:0;\nb.digitalWrite(pin, level);\n\nreturn msg;","outputs":1,"x":347.16666412353516,"y":129.16666412353516,"wires":[["55249ec9.21e61"]]}]
46+
````json
47+
[{"id":"b1fce44.9ce3c18","type":"inject","name":"on","topic":"","payload":"1","repeat":"","once":false,"x":127.16666412353516,"y":109.16666412353516,"wires":[["b2a66e5e.6da6f"]]},{"id":"591aef4d.b55f38","type":"inject","name":"off","topic":"","payload":"0","repeat":"","once":false,"x":127.16666412353516,"y":149.16666412353516,"wires":[["b2a66e5e.6da6f"]]},{"id":"36f2a960.164f76","type":"inject","name":"tick","topic":"","payload":"","repeat":"1","once":false,"x":127.16666412353516,"y":49.166664123535156,"wires":[["7ee460bc.df48e"]]},{"id":"55249ec9.21e61","type":"debug","name":"","active":true,"x":567.1666641235352,"y":89.16666412353516,"wires":[]},{"id":"7ee460bc.df48e","type":"function","name":"Toggle USR3 LED on input","func":"\nvar pin = \"USR3\"\nvar b = context.global.bonescript;\ncontext.state = context.state || b.LOW;\n\nb.pinMode(pin, b.OUTPUT);\n\n(context.state == b.LOW) ? context.state = b.HIGH : context.state = b.LOW;\nb.digitalWrite(pin, context.state);\n\nreturn msg;","outputs":1,"x":347.16666412353516,"y":69.16666412353516,"wires":[["55249ec9.21e61"]]},{"id":"b2a66e5e.6da6f","type":"function","name":"Set USR2 LED on input","func":"\nvar pin = \"USR2\";\nvar b = context.global.bonescript;\n\nb.pinMode(pin, b.OUTPUT);\n\nvar level = (msg.payload === \"1\")?1:0;\nb.digitalWrite(pin, level);\n\nreturn msg;","outputs":1,"x":347.16666412353516,"y":129.16666412353516,"wires":[["55249ec9.21e61"]]}]
48+
````
4749

4850
Click the deploy button and the flow should start running. USR3 LED should start
4951
toggling on and off once a second. USR2 LED can be manually set on or off using
@@ -69,7 +71,7 @@ files.
6971
[Install]
7072
WantedBy=multi-user.target
7173

72-
##### /home/root/go.sh :
74+
##### /home/root/go.sh :
7375

7476
#!/bin/bash -
7577
ntpdate pool.ntp.org
@@ -86,12 +88,11 @@ Node-RED should now be running in a screen session. You can attach to the
8688
session by running:
8789

8890
$ screen -r red
89-
91+
9092
To detach from the session, type Ctrl-A-D.
9193

9294
Note that `go.sh` also tries to set the clock correctly using `ntpdate`. You
9395
shouldn't have to do this but we found the BBB does sometimes take an age to
9496
sync up - so forcing it helps.
9597

9698
Other useful hints are available here: <http://www.gigamegablog.com/2012/01/29/beaglebone-linux-101-configuring-angstrom-linux/>
97-

docs/hardware/raspberrypi.md

+12-10
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ There are (at least) two ways for interacting with a Raspberry Pi using Node-RED
1414
Function nodes.
1515

1616
***
17-
17+
1818
### pi-gpio
1919

2020
*pi-gpio is no longer maintained. We will be migrating to an alternative soon*
@@ -24,7 +24,7 @@ command-line tool.
2424

2525
#### Installation
2626

27-
After [installing](../getting-started/installation.html) Node-RED, follow these
27+
After [installing](../getting-started/installation.html) Node-RED, follow these
2828
[instructions](https://github.com/rakeshpai/pi-gpio#installation) to get both
2929
gpio-admin and pi-gpio installed.
3030

@@ -40,7 +40,9 @@ Then copy the following flow and paste it into the Import Nodes dialog
4040
(*Import From - Clipboard* in the dropdown menu, or Ctrl-I). After clicking
4141
okay, click in the workspace to place the new nodes.
4242

43-
[{"id":"12c3cae6.ed3c35","type":"debug","name":"","active":true,"x":561,"y":119,"wires":[]},{"id":"d4b2ed80.2b4d1","type":"rpi-gpio out","name":"","resistor":"no","pin":"11","x":561,"y":59,"wires":[]},{"id":"5e5e53c0.a1a1ac","type":"inject","name":"tick every 1 sec","topic":"","payload":"","repeat":"1","once":false,"x":121,"y":59,"wires":[["63dad785.9c2528"]]},{"id":"63dad785.9c2528","type":"function","name":"Toggle 0/1 on input","func":"\ncontext.state = context.state || 0;\n\n(context.state == 0) ? context.state = 1 : context.state = 0;\nmsg.payload = context.state;\n\nreturn msg;","outputs":1,"x":321,"y":59,"wires":[["12c3cae6.ed3c35","d4b2ed80.2b4d1"]]}]
43+
````json
44+
[{"id":"12c3cae6.ed3c35","type":"debug","name":"","active":true,"x":561,"y":119,"wires":[]},{"id":"d4b2ed80.2b4d1","type":"rpi-gpio out","name":"","resistor":"no","pin":"11","x":561,"y":59,"wires":[]},{"id":"5e5e53c0.a1a1ac","type":"inject","name":"tick every 1 sec","topic":"","payload":"","repeat":"1","once":false,"x":121,"y":59,"wires":[["63dad785.9c2528"]]},{"id":"63dad785.9c2528","type":"function","name":"Toggle 0/1 on input","func":"\ncontext.state = context.state || 0;\n\n(context.state == 0) ? context.state = 1 : context.state = 0;\nmsg.payload = context.state;\n\nreturn msg;","outputs":1,"x":321,"y":59,"wires":[["12c3cae6.ed3c35","d4b2ed80.2b4d1"]]}]
45+
````
4446

4547
Click the deploy button and the flow should start running. The LED should start
4648
toggling on and off once a second.
@@ -55,8 +57,8 @@ expansion board. More details about WiringPi are available [here](http://wiringp
5557

5658
#### Installation
5759

58-
After [installing](../getting-started/installation.html) Node-RED, follow these
59-
[instructions](http://wiringpi.com/download-and-install/) to get Wiring Pi
60+
After [installing](../getting-started/installation.html) Node-RED, follow these
61+
[instructions](http://wiringpi.com/download-and-install/) to get Wiring Pi
6062
installed.
6163

6264
#### Configuring Node-RED
@@ -67,7 +69,7 @@ available for use in Function nodes.
6769
To do this, update `settings.js` to add the `wiring-pi` module to the Function
6870
global context:
6971

70-
functionGlobalContext: {
72+
functionGlobalContext: {
7173
wpi: require('wiring-pi')
7274
}
7375

@@ -82,7 +84,9 @@ Then copy the following flow and paste it into the Import Nodes dialog
8284
(*Import From - Clipboard* in the dropdown menu, or Ctrl-I). After clicking
8385
okay, click in the workspace to place the new nodes.
8486

85-
[{"id":"860e0da9.98757","type":"function","name":"Toggle LED on input","func":"\n// select wpi pin 0 = pin 11 on header (for v2)\nvar pin = 0;\n\n// initialise the wpi to use the global context\nvar wpi = context.global.wpi;\n\n// use the default WiringPi pin number scheme...\nwpi.setup();\n\n// initialise the state of the pin if not already set\n// anything in context. persists from one call to the function to the next\ncontext.state = context.state || wpi.LOW;\n\n// set the mode to output (just in case)\nwpi.pinMode(pin, wpi.modes.OUTPUT);\n\n// toggle the stored state of the pin\n(context.state == wpi.LOW) ? context.state = wpi.HIGH : context.state = wpi.LOW;\n\n// output the state to the pin\nwpi.digitalWrite(pin, context.state);\n\n// we don't \"need\" to return anything here but may help for debug\nreturn msg;","outputs":1,"x":333.16666412353516,"y":79.16666793823242,"wires":[["574f5131.36d0f8"]]},{"id":"14446ead.5aa501","type":"inject","name":"tick","topic":"","payload":"","repeat":"1","once":false,"x":113.16666412353516,"y":59.16666793823242,"wires":[["860e0da9.98757"]]},{"id":"574f5131.36d0f8","type":"debug","name":"","active":true,"x":553.1666641235352,"y":99.16666793823242,"wires":[]}]
87+
````json
88+
[{"id":"860e0da9.98757","type":"function","name":"Toggle LED on input","func":"\n// select wpi pin 0 = pin 11 on header (for v2)\nvar pin = 0;\n\n// initialise the wpi to use the global context\nvar wpi = context.global.wpi;\n\n// use the default WiringPi pin number scheme...\nwpi.setup();\n\n// initialise the state of the pin if not already set\n// anything in context. persists from one call to the function to the next\ncontext.state = context.state || wpi.LOW;\n\n// set the mode to output (just in case)\nwpi.pinMode(pin, wpi.modes.OUTPUT);\n\n// toggle the stored state of the pin\n(context.state == wpi.LOW) ? context.state = wpi.HIGH : context.state = wpi.LOW;\n\n// output the state to the pin\nwpi.digitalWrite(pin, context.state);\n\n// we don't \"need\" to return anything here but may help for debug\nreturn msg;","outputs":1,"x":333.16666412353516,"y":79.16666793823242,"wires":[["574f5131.36d0f8"]]},{"id":"14446ead.5aa501","type":"inject","name":"tick","topic":"","payload":"","repeat":"1","once":false,"x":113.16666412353516,"y":59.16666793823242,"wires":[["860e0da9.98757"]]},{"id":"574f5131.36d0f8","type":"debug","name":"","active":true,"x":553.1666641235352,"y":99.16666793823242,"wires":[]}]
89+
````
8690

8791
Click the `Deploy` button and the flow should start running. The LED should start
8892
toggling on and off once a second.
@@ -110,7 +114,5 @@ Once you reboot you should then be able to attach to the screen session by
110114
running:
111115

112116
$ screen -r red
113-
114-
To detach from the session, type Ctrl-A-D.
115-
116117

118+
To detach from the session, type Ctrl-A-D.

0 commit comments

Comments
 (0)