• Stars
    star
    208
  • Rank 189,015 (Top 4 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created about 10 years ago
  • Updated almost 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Base functionality for working with a Raspberry Pi from Node.js

Raspi.js

Gitter

Raspi.js provides initialization and base support for the Raspberry Pi. This module, along with Raspi Board and Raspi Peripheral, provide support for various peripherals on the Raspberry Pi. These libraries form the basis for Raspi IO, an IO plugin that adds support for the Raspberry Pi to Johnny-Five.

Check out the following peripheral API modules:

If you have a bug report, feature request, or wish to contribute code, please be sure to check out the Raspi IO Contributing Guide.

System Requirements

  • Raspberry Pi Model B Rev 1 or newer (sorry Model A users)
  • Raspbian Jessie or newer
  • Node 4.0.0 or newer

Detailed instructions for getting a Raspberry Pi ready for NodeBots, including how to install Node.js, can be found in the wiki

Warning: when using this module, it MUST be installed with user-level permissions, but run with root permissions (e.g. sudo node index.js).

Installation

Install with npm:

npm install raspi

Note: this project is written in TypeScript and includes type definitions in the package.json file. This means that if you want to use it from TypeScript, you don't need to install a separate @types module.

Example Usage

In TypeScript/ES6:

import { init } from 'raspi';
import { DigitalInput, DigitalOutput } from 'raspi-gpio';

init(() => {
  const input = new DigitalInput('P1-3');
  const output = new DigitalOutput('P1-5');
  output.write(input.read());
});

in JavaScript:

const raspi = require('raspi');
const gpio = require('raspi-gpio');

raspi.init(() => {
  const input = new gpio.DigitalInput('P1-3');
  const output = new gpio.DigitalOutput('P1-5');
  output.write(input.read());
});

API

Module Constants

Constant Description
module An easily consumable object for indirectly passing this module around. Intended specifically for use by Core IO (details coming soon)
Property Type Description
init Alias of the init method

init(cb)

The init method initializes the library suite. This method MUST be called before using any peripherals.

Arguments:

Argument Type Description
cb Function Callback to be called once the board has been initialized. Takes no arguments
Takes no arguments

Returns: None

License

The MIT License (MIT)

Copyright (c) 2014-2017 Bryan Hughes [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

raspi-io

An IO plugin for Johnny-Five that provides support for the Raspberry Pi
TypeScript
545
star
2

request-inspector

A request timing diagnostic tool for Web and Node.js applications
TypeScript
53
star
3

raspi-gpio

Provides access to GPIO on the Raspberry Pi from Node.js
TypeScript
53
star
4

raspi-serial

Provides access to the serial port on the Raspberry Pi as part of the Raspi.js library suite
TypeScript
35
star
5

raspi-i2c

Provides access to I2C on the Raspberry Pi from Node.js
TypeScript
30
star
6

raspi-board

Machine-digestible pin information for the Raspberry Pi
TypeScript
29
star
7

user-management

User authentication and management for Node.js using MongoDB
JavaScript
29
star
8

raspi-pwm

Provides access to PWM on the Raspberry Pi from Node.js
TypeScript
27
star
9

aquarium-control

A Raspberry Pi based system for controlling the lights and monitoring temperature in my Aquarium with a Raspberry Pi
TypeScript
27
star
10

dynloader

A dynamic module loader for the browser
TypeScript
18
star
11

raspi-llio

Provides Node.js bindings to the WiringPi library for controlling a Raspberry Pi's I/O
JavaScript
16
star
12

contact-scheduler

A desktop application for scheduling times to reach out to folks regularly that plays nicely with my anxiety
TypeScript
13
star
13

conditional-reduce

Construct a JavaScript expression that returns a value based on an enumerated list of possible values
TypeScript
12
star
14

abstract-io

An interface and base class for creating Johnny-Five IO plugins
TypeScript
10
star
15

commascript

A statically typed, backwards compatible dialect of JavaScript
JavaScript
10
star
16

nodesummit2016

Hardware Day Zero information
C
8
star
17

johnny-five-iot-edge

An IoT Edge module for interacting with hardware based on http://johnny-five.io/
JavaScript
8
star
18

twitter-replies-parser

Takes replies from a tweet and parses them into a spreadsheet
JavaScript
8
star
19

raspi-led

Control of the on-board LED from Node.js
TypeScript
7
star
20

simple-analytics

Simple node.js based real-time site analytics server
JavaScript
7
star
21

reduxology

A library that makes it easier to manage boilerplate and reason about React Redux applications
TypeScript
7
star
22

typescript-workshop

A real-world workshop for TypeScript in the server and browser
TypeScript
7
star
23

j5-io

An abstract library for creating Raspi IO plugins
TypeScript
6
star
24

raspi-soft-pwm

Provides access to Software PWM on the Raspberry Pi from Node.js through pigpio
TypeScript
5
star
25

heya

A platform for creating SumoBots
JavaScript
4
star
26

raspi-419

An implementation of the ECMA-419 spec on the Raspberry Pi
TypeScript
4
star
27

seriallog

Logs the output from a serial port in real time
JavaScript
4
star
28

raspi-peripheral

Provides a base class and pin management functions for the raspi suite
JavaScript
3
star
29

nodeconfeu2016

Starter template for NodeConf EU 2016 IoT workshop
JavaScript
3
star
30

raspi-birthday

A little birthday project for Raspi IO!
JavaScript
3
star
31

react-strapped

A React library for managing bootstrap data in multi-page applications
TypeScript
3
star
32

need-to-node-typescript-demo

Demo for my TypeScript Need to Node webinar on 7/19/2016
TypeScript
3
star
33

hwt-dut

The main server that runs on each device under test and manages testing. Part of the HwT suite.
JavaScript
3
star
34

workshop-node-summit-2018

Information for the NodeBots workshop at Node Summit 2018
3
star
35

recoil-bootstrap

Recoil Bootstrap enables apps to initialize Recoil with runtime bootstrap data in multi-page applications, such as in Next.js.
TypeScript
2
star
36

dissertation_paper

All of the content for my dissertation paper, written in LaTeX
TeX
2
star
37

incident-reporter

Incident reporting system and hotline for events using Twilio
JavaScript
2
star
38

nodesummit-nodebots-2017

Information for the NodeBots workshop at Node Summit 2017
2
star
39

resin-io-test

Test project for resin.io
JavaScript
1
star
40

rdio-visualizer

blah
JavaScript
1
star
41

eol-tools

A set of tools for working with EOL markings
JavaScript
1
star
42

taskman

A Node.JS library for managing (possibly) asynchronous operations
JavaScript
1
star
43

schat

A reasonably secure chat program featuring client and server encryption
JavaScript
1
star
44

flvx

A lightweight web framework based on Facebook's Flux paradigm
JavaScript
1
star
45

dissertation_project

The source code for the firmware part of my dissertation project
C
1
star
46

raspi-tools

A collection of tools for developing raspi-io
TypeScript
1
star
47

esp-hello-world

A complete Hello World project for the ESP-01
1
star
48

wait-for-ip

A simple Node.js library that waits for an IP address to be obtained
JavaScript
1
star
49

rprez

Electron.js based presentation software
TypeScript
1
star
50

images-to-website

A bespoke script to convert a series of images to a website
JavaScript
1
star
51

azure-led-booth

An LED art piece for conference booths that attendees can control from Azure
TypeScript
1
star
52

raspi-wiringpi

Wrapper around Wiring Pi so it can be installed via NPM
Shell
1
star
53

raspi-onewire

Provides access to 1-Wire on the Raspberry Pi from Node.js
TypeScript
1
star