Skip to content

gabrielnvg/gpio-nodejs-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Control your Raspberry Pi's GPIO via HTTP requests.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published