SPI2.setup({ mosi: B15, sck: B13 }); var disp = require("MAX7219").connect(SPI2, B14, 16); /** 呼吸灯效 */ function breath() { var light = 0.01; var increase = true; setInterval(function () { if (increase) { light += 0.01; } else { light -= 0.01; } if (light > 0.99) { increase = false; } else if (light < 0.01) { increase = true; } disp.intensity(light); // 亮度 }, 30); } function onInit() { var data = [ 0, 0, 0, 0, 96, 2, 36, 0, 0, 0, 0, 0, 72, 2, 200, 33, 0, 14, 0, 0, 32, 2, 36, 8, 128, 0, 0, 0, 160, 1, 72, 41, 224, 15, 0, 0, 32, 2, 70, 16, 0, 28, 0, 30, 144, 7, 72, 40, 96, 2, 0, 0, 16, 2, 128, 63, 248, 49, 248, 48, 96, 121, 40, 46, 64, 2, 192, 0, 8, 2, 0, 30, 12, 0, 8, 34, 16, 49, 8, 32, 64, 50, 128, 49, 4, 2, 0, 0, 228, 3, 200, 33, 132, 1, 248, 63, 192, 63, 0, 33, 0, 2, 0, 0, 192, 4, 8, 38, 192, 1, 0, 0, 126, 2, 4, 0, 0, 0, 0, 0, 96, 4, 232, 33, 128, 0, 0, 0 ]; disp.raw(new Uint8Array(data).buffer); breath(); } onInit();
@Sigma started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.