1import * as gpio from 'gpio'; 2 3var led = gpio.open({ 4 id: 'led', 5 success: function() { 6 console.log('gpio: open led success') 7 }, 8 fail: function() { 9 console.log('gpio: open led failed') 10 } 11}); 12 13var vol = 0; 14setInterval(function() { 15 vol = 1 - vol; 16 led.writeValue(vol); 17 console.log('gpio: led set value ' + vol); 18}, 2000); 19 20 21