/* * Author: Jon Trulson * Copyright (c) 2015 Intel Corporation. * * Author: Tyler Gibson * Copyright (c) 2015 Microsoft Corporation. * * This program and the accompanying materials are made available under the * terms of the The MIT License which is available at * https://opensource.org/licenses/MIT. * * SPDX-License-Identifier: MIT */ var lcdObj = require('jsupm_lcd'); 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