npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

edison-oled

v0.0.5

Published

Node wrapper for Sparkfun Edison OLED Block. Includes wrappers around OLED, GPIO and SPI classes.

Downloads

32

Readme

NodeJS Wrapper for SparkFun Edison OLED Block

Developing a node app for your Edison? Need to use the OLED display from SparkFun, GPIO pins or SPI? You're in luck!

Features

* OLED 
* GPIO
* SPI

NOTES

* This has only been tested with the SparkFun Edison OLED Block, but GPIO and SPI should (may possibly) work with other hardware.
* SPI - need to use a CS pin on Edison other than the default pin 23 (GP110), the MRAA library won't work. This library works using a pin of your choosing (tested with pin 9 (GP111)). 
* GPIO pin mraa /edison reference mapping may be useful - https://github.com/intel-iot-devkit/mraa/blob/master/docs/edison.md#intelr-breakout-board
* The files in the Tests folder are meant to be run on an Intel Edison as they interact with the hardware.

Installation

This module is only designed to work on the Intel Edison.

$ npm install edison-oled

You may need to use the --unsafe-perm option if you get the warning "cannot run in wd".

$ npm install edison-oled --unsafe-perm

API

Example using the OLED screen

var edison = require('edison-oled');

//create Oled
var oled = new edison.Oled();

//setup input buttons
var btnUp = new edison.Gpio(47, edison.INPUT);
var btnDown = new edison.Gpio(44, edison.INPUT);
var btnLeft = new edison.Gpio(165, edison.INPUT);
var btnRight = new edison.Gpio(45, edison.INPUT);
var btnSelect = new edison.Gpio(48, edison.INPUT);
var btnA = new edison.Gpio(49, edison.INPUT);
var btnB = new edison.Gpio(46, edison.INPUT);

//setup screen
oled.begin();
oled.clear(0);
oled.display();
oled.setFontType(0);	

//draw on screen
oled.clear();
oled.setCursor(14, 5);
oled.print("Press A");
oled.setCursor(2, 13);
oled.print("for single");
oled.setCursor(14, 30);
oled.print("Press B");
oled.setCursor(6, 38);
oled.print("for multi");
oled.display();	

//wait for user to make a choice using Button A or Button B
while (btnA.pinRead() == edison.HIGH && btnB.pinRead() == edison.HIGH) {}

Example uses SPI and GPIO to communicate with OLED hardware (not a complete example, see test-spi.js for full code)

var edison = require('edison-oled');

//setup pins needed for SPI
var cspin = new edison.Gpio(111, edison.OUTPUT, edison.HIGH); //chip select  --> edison_oled.c code uses 111 mraa uses 9
var dcpin = new edison.Gpio(14, edison.OUTPUT, edison.HIGH); //data/command --> edison_oled.c code uses 14 mraa uses 36
var rstpin = new edison.Gpio(15, edison.OUTPUT, edison.HIGH); //reset --> edison_oled.c code uses 15 mraa uses 48
var sclkpin = new edison.Gpio(109, edison.SPI, edison.HIGH); //sclk --> edison_oled.c code uses 109 mraa uses 10
var mosipin = new edison.Gpio(115, edison.SPI, edison.HIGH); //mosi --> edison_oled.c code uses 115 mraa uses 11
var misopin = new edison.Gpio(114, edison.SPI, edison.HIGH); //miso --> edison_oled.c code uses 114 mraa uses 24

//create spi
var spi = new edison.Spi(edison.SPI_MODE_0, 10000000, false, cspin);

//reset screen
rstpin.pinWrite(edison.HIGH);
//should add a wait time here for a few milliseconds
rstpin.pinWrite(edison.LOW);
//should add a wait time here for a few milliseconds
rstpin.pinWrite(edison.HIGH);
	
//send commands to OLED
dcpin.pinWrite(edison.LOW); // DC pin LOW
spi.transferData(edison.DISPLAYOFF);
spi.transferData(edison.SETDISPLAYCLOCKDIV);
spi.transferData(0x80);
	
//send data to OLED
dcpin.pinWrite(edison.HIGH); //DC pin HIGH
spi.transferData(0xFF);

SparkFun Edison OLED Block

SparkFun Edison OLED Block

SparkFun Edison OLED Block(DEV-13035)

Equip your Edison with a graphic display using the Edison OLED board! This board features a 0.66", 64x48 pixel monochrome OLED.

To add some control over your Edison and the OLED, this board also includes a small joystick and a pair of push-buttons. Use them to create a game, file navigator, or more!

Repository Contents

  • /Firmware - Example Pong sketch to demonstrate OLED Functionality.
  • /Hardware - All Eagle design files (.brd, .sch)
  • /Production - Test bed files and production panel files

Documentation

License Information

This product is open source!

Please review the LICENSE.md file for license information.

If you have any questions or concerns on licensing, please contact [email protected].

Distributed as-is; no warranty is given.

  • Your friends at SparkFun.