/*jslint node:true, vars:true, bitwise:true, unparam:true */ /*jshint unused:true */ /* * Author: Jon Trulson * Copyright (c) 2015 Intel Corporation. * * Author: Tyler Gibson * Copyright (c) 2015 Microsoft Corporation. * * 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. */ var lcdObj = require('jsupm_i2clcd'); var oled = new lcdObj.EBOLED(); var sample = 0; var samples = 13; function exit() { oled = null; lcdObj.cleanUp(); lcdObj = null; process.exit(0); } setInterval( function() { if(sample>samples) { exit(); } oled.clearScreenBuffer(); runSample(sample++); oled.refresh(); }, 1500); function runSample(sample) { switch(sample) { case 0: // x/y coords are 0 based, using 1 here for padding. oled.setCursor(1,1); // nowrap = 0, wrapping = 1 oled.setTextWrap(1); oled.write("HELLO WORLD! Mixed with #123 and y's, g's and q's."); break; case 1: oled.setCursor(12, 1); //multiply text size, only integers oled.setTextSize(3); oled.write("BOO!"); oled.setTextSize(1); break; case 2: oled.drawRectangleFilled(0,0,48,9); oled.setCursor(1,1); // 0=Black, 1=White, 2=Xor (Toggle) oled.setTextColor(2); oled.write("Cutout"); break; case 3: var total = Math.random()*100; for(var stars=0; stars