Pi Nodes
Combine great hardware projects that use the Raspberry Pi GPIO pins and a Node.js web server that interacts with the underlying operating system and hardware, and you have a winning team.
Lead Image © Alexander Sidorov, 123RF.com
Combine great hardware projects that use the Raspberry Pi GPIO pins and a Node.js web server that interacts with the underlying operating system and hardware, and you have a winning team.
Reading values from sensors connected to Raspberry Pi (Rasp Pi) GPIO pins and displaying the results on the command line is satisfying, but being able to access your sensors remotely is where things start getting useful. The best way to do that is to use a tried and tested medium, the web, and the way to do that is by using Node.js [1].
Node.js is not just for big corporate projects. In fact, Node.js (or more specifically, the node
executable supplied in Node.js installations) is, at its simplest, just a JavaScript interpreter. That's it. It lets you write scripts in JavaScript and then it runs them, just as you would run a Bash, Python, or Perl script.
For example, you can make the following code in Listing 1 executable (chmod a+x countdown.js
) and run it from the command line.
[...]
Pages: 8
Price $15.99
(incl. VAT)