This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Captive Portal | |
var http = require('http'); | |
var Wifi = require('Wifi'); | |
var dgram = require('dgram'); | |
var server = dgram.createSocket('udp4'); | |
var SSID = 'CaptivePortalTest'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// scrollString.js | |
// tested on ESP8266 12F | |
var pin = D4; | |
// connected to three neopixel plate (x,y)=(0-7,0-23) | |
var leds = Graphics.createArrayBuffer(8,24,24); | |
leds.setRotation(1,false); | |
leds.flip = function(){require("neopixel").write(pin,leds.buffer);}; | |
leds.off = function(){leds.clear();leds.flip();}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
test_remap.js | |
sample how to remap a pixel on a sequential 8x8 wired panel | |
*/ | |
var np = { | |
pin : D4, | |
neopixels : 0, | |
leds : [], | |
pannelList : [], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void jswrap_wifi_save(JsVar *what) { | |
DBGV("> Wifi.save\n"); | |
JsVar *o = jsvNewObject(); | |
if (!o) return; | |
if (jsvIsString(what) && jsvIsStringEqual(what, "clear")) { | |
JsVar *name = jsvNewFromString(WIFI_CONFIG_STORAGE_NAME); | |
jswrap_storage_erase(name); | |
jsvUnLock(name); | |
DBG("Wifi.save(clear)\n"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void jswrap_wifi_restore(void) { | |
DBG("Wifi.restore\n"); | |
JsVar *name = jsvNewFromString(WIFI_CONFIG_STORAGE_NAME); | |
JsVar *o = jswrap_storage_readJSON(name); | |
if (!o) { // no data | |
jsvUnLock2(name,o); | |
return; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
function queue | |
based on | |
https://stackoverflow.com/questions/17528749/semaphore-like-queue-in-javascript/17528961#17528961 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var s = require('Storage'); | |
/* use this code only once to save font and widths in Storage | |
s.write('fHN7x17',atob("AAAAAAAAAAAB/MAAAJAAcAAAABIADgAAAAACAAngB4AeeAHgB5AAQAAAAHEAREAiID/4CIgERAEcAAAAwMCQgEmAGTADJAISBgYAAAAHgHQgRBAjCA5kAAwAPQAAAkABwAAAAAfADBgIAggAgAACACCAIDBgB8AAAAEgAGAA/AAYABIAAAABAACAAEAB/AAQAAgABAAAAAAkABwAAAAgABAACAAEAAIAAAAADAAGAAAAAIABgAMABgAMABgAAAAB/AEBAQxAjCAgIA/gAAACAAIAAgAB/8AAACBwIMgQhAiCA4EAAACAgIAgQhAhCA94AAAAGAA0ACIAYQB/8ABAAAAPhARBAiCBEECHwAAAH/ARBAiCBEEBHwAAAIAAQPAhgBMADgAAAAHvAQhAhCBCEB7wAAAHhAQhAhCBCEB/wAAADDAGGAAAAYUAwwAAAAQABQAEQAQQBAQAAABEACIAEQAIgARAAiAAAAICAIIAIgAKAAIAAAAIAAgABBMCEAEQAHAAAAAf8BAECOIEiQJEgP4AAAAP8BiAEEAGIAD/AAAB/8CEIEIQIQgPeAAAA/4CAIEAQIAgICAAAB/8CAIEAQEBAH8AAAB/8CEIEIQIQgQBAAAB/8CIAEQAIgAQAAAAA/4CAIEAQIQgI+AAAB/8AEAAIAAQAf/AAABAED/4EAQAAAQGAgCBAECAIH/gAAAf/ABAAFAAxgGAwAAAf/AACAAEAAIAAQAAAf/AYAAMABgAH/wAAAf/AYAAMAAGAH/wAAAP+AgCBAECAID/gAAAf/AhABCACEADwAAAAP+AgCBAUCAQD/QAAAf/AhABCACHADxwAAAOCAiCBCECCICDgAAAQAAgAB/8CAAEAAAAAf+AACAAEAAIH/gAAAfAAB4AAMAHgHwAAAAf8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s = require('Storage'); | |
s.write('SBUS',`exports.connect = function(uart, rxPin) { | |
var sbus = { | |
channels : new Uint16Array(18), | |
frameLoss : false, | |
failSafe : false | |
}; | |
uart.setup(100000, {rx:rxPin, parity:"e",stopbits:2}); | |
uart.removeAllListeners(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
g.clear(); | |
g.setFont("6x8",3); | |
g.setColor(0x07E0); | |
g.drawString("Welcome\nto the\nBangle.js\nEmulator",20,60); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var flake1 = [114,120,126,120,126,150,150,168,144,180,126,168,126,192,114,192,114,168,96,180,90,168,114,150,114,120]; | |
var flake2 = [114,20,126,20,126,50,150,68,144,80,126,68,126,92,114,92,114,68,96,80,90,68,114,50,114,20]; | |
g.clear(); | |
g.drawPoly(flake1); | |
g.fillPoly(flake2); |
OlderNewer