Skip to content

Latest commit

 

History

History
28 lines (23 loc) · 1.04 KB

README.md

File metadata and controls

28 lines (23 loc) · 1.04 KB

Installation

On project's directory, run:

$ npm install

Usage

Running the server

On project's directory, run:

$ npm start

It will be running at http://localhost:3001/

Reading all GPIO ports

Go to http://localhost:3001/readall

Reading a specific pin state

On the URL, write a GPIO pin number (pin's name number, not physical number).

Writing a value to a pin

On the URL, write a GPIO pin's number (pin's name number, not physical number), its direction (1 for INPUT or 0 for OUTPUT) and its value (1 for HIGH or 0 for LOW).

Observations

  • The port 3001 was chosen so it would not conflict with other Node.js apps such as Amazon's Alexa on Raspberry pi.
  • This project uses Node.js' child_process to execute shell commands, so be sure to check if your user has GPIO permission.