var Matrix = function(data) { if (typeof data == 'undefined') data = {} this.brightness = data.brightness || 15; this.write_buffer = []; this.current_array = []; rpio.i2cBegin(); rpio.i2cSetSlaveAddress(data.slaveAddress || 0x70); rpio.i2cSetBaudRate(data.bautrate || 10000); // Turn on the oscillator rpio.i2cWrite(Buffer([(0x20 | 0x01)])); // Turn display on rpio.i2cWrite(Buffer([(0x01 | 0x80)])); // Initial Clear for (var x = 0; x < 16; x++) { rpio.i2cWrite(Buffer([x, 0])); } // Set display to full brightness. rpio.i2cWrite(Buffer([(0xE0 | this.brightness)])); }
/** * Create a new instance of the ADCDifferentialPi object and initialise it with the specified parameters * @param {number} address1 - I2C address for channels 1 to 4 * @param {number} address2 - I2C address for channels 5 to 8 * @param {number} rate - Bit rate for ADC sampling: 12, 14, 16, 18 */ function ADCDifferentialPi(address1, address2, rate) { address1 = this.address1; address2 = this.address2; this.setBitRate(rate); this.setConversionMode(1); rpio.i2cBegin(); rpio.i2cSetBaudRate(10000); }
var rpio = require('rpio') var fontLookup = require('./fontArray.js'); var AlphNum1_Add = 0x70; // Address of first HT16K33 LEDS var AlphNum2_Add = 0x71; // Address of second bank. Set to null if not attached var dsplyOnOff = 1; // 1 = On var dsplyBlink = 0; // 0 = No blinking exports.prnStr = prnStr; exports.prn2Strs = prn2Strs; exports.setBright = setBright; exports.blinkDisplay = blinkDisplay; exports.prnSentence = prnSentence; // Works best if sentence has 8 charcter words or less // Setup i2c pins rpio.i2cBegin(); rpio.i2cSetBaudRate(100000); /* 100kHz */ // Turn on system oscillatior console.log("Powering up bank 1..."); rpio.i2cSetSlaveAddress(AlphNum1_Add); rpio.i2cWrite(Buffer([0x21])); rpio.i2cWrite(Buffer([0x81])); if (AlphNum2_Add){ console.log("Powering up bank 2...") rpio.i2cSetSlaveAddress(AlphNum2_Add); rpio.i2cWrite(Buffer([0x21])); rpio.i2cWrite(Buffer([0x81])); }