arnlen / first_api_device

Rails app to trigger Raspberry GPIO pins through API calls

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

First API Device

Goal: switch on/off a LED through HTTP calls.

First test app to try to trigger Raspberry GPIO pins through API calls.

Installation (on your Raspberry)

  1. Install PiPiper with sudo privileges
  2. Git clone
  3. Bundle install
  4. Connect LED to GPIO PIN #17

Usage

Raspberry side: Rails server start

If you want to access your server from another device (ie: from your phone, which is cool!), you have to start the Rails server on port 80 and allow any ip address:

rbenv sudo rails s -p 80 -b 0.0.0.0

Computer/Smartphone side: requests

Switch on LED:

http://<raspberry_ip>/led/on

Switch off LED:

http://<raspberry_ip>/led/off

About

Rails app to trigger Raspberry GPIO pins through API calls


Languages

Language:Ruby 80.6%Language:HTML 19.4%