Coder Social home page Coder Social logo

msudak / pi-websocket Goto Github PK

View Code? Open in Web Editor NEW

This project forked from patrickfuller/pi-websocket

0.0 2.0 0.0 232 KB

Toggle an LED from your browser using websockets and a raspberry pi.

License: MIT License

JavaScript 36.47% HTML 11.76% Python 32.03% CSS 19.74%

pi-websocket's Introduction

pi-websocket

Toggle an LED from your browser using websockets and a raspberry pi.

This repository is intended to be a "hello world" for controlling things with your pi + websockets. It's short and modular, and adding other pi functions or UI elements should be simple and straightforward.

Why websockets?

There are already many servers written for the Pi utilizing HTTP protocols. However, websockets offer low-latency communication and tighter JSON-RPC structures (source). This protocol may be more complex to set up for the first time, but working with it is clean and simple.

This library does not use websocket wrappers like socket.io or fallback protocols like Flash. This is pure websocket. As such, it requires using a supported browser.

Requirements

Get a raspberry pi. Wire an LED to it like so:

Open a terminal in your pi, and install these Python dependencies:

pip install tornado RPi.GPIO

Then clone this repository:

git clone https://github.com/patrickfuller/pi-websocket.git

Usage

On your pi, run the server:

cd pi-websocket
sudo python server.py

Open a browser and point it to http://your.pi.ip.address:8000. You can now remotely toggle that LED remotely to your heart's content!

pi-websocket's People

Contributors

patrickfuller avatar

Watchers

James Cloos avatar Mariusz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.