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 = ; //create Oledvar oled = ; //setup input buttonsvar btnUp = 47 edisonINPUT;var btnDown = 44 edisonINPUT;var btnLeft = 165 edisonINPUT;var btnRight = 45 edisonINPUT;var btnSelect = 48 edisonINPUT;var btnA = 49 edisonINPUT;var btnB = 46 edisonINPUT; //setup screenoled;oledclear0;oleddisplay;oled; //draw on screenoledclear;oled;oled;oled;oled;oled;oled;oled;oled;oleddisplay; //wait for user to make a choice using Button A or Button Bwhile btnA == edisonHIGH && btnB == edisonHIGH {}
Example uses SPI and GPIO to communicate with OLED hardware (not a complete example, see test-spi.js for full code)
var edison = ; //setup pins needed for SPIvar cspin = 111 edisonOUTPUT edisonHIGH; //chip select --> edison_oled.c code uses 111 mraa uses 9var dcpin = 14 edisonOUTPUT edisonHIGH; //data/command --> edison_oled.c code uses 14 mraa uses 36var rstpin = 15 edisonOUTPUT edisonHIGH; //reset --> edison_oled.c code uses 15 mraa uses 48var sclkpin = 109 edisonSPI edisonHIGH; //sclk --> edison_oled.c code uses 109 mraa uses 10var mosipin = 115 edisonSPI edisonHIGH; //mosi --> edison_oled.c code uses 115 mraa uses 11var misopin = 114 edisonSPI edisonHIGH; //miso --> edison_oled.c code uses 114 mraa uses 24 //create spivar spi = edisonSPI_MODE_0 10000000 false cspin; //reset screenrstpin;//should add a wait time here for a few millisecondsrstpin;//should add a wait time here for a few millisecondsrstpin; //send commands to OLEDdcpin; // DC pin LOWspi;spi;spi; //send data to OLEDdcpin; //DC pin HIGHspi;
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
- Hookup Guide - Basic hookup guide for the OLED Block.
- SparkFun Fritzing repo - Fritzing diagrams for SparkFun products.
- SparkFun 3D Model repo - 3D models of SparkFun products.
- SparkFun Graphical Datasheets -Graphical Datasheets for various SparkFun products.
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 techsupport@sparkfun.com.
Distributed as-is; no warranty is given.
- Your friends at SparkFun.