1import * as dac from 'dac' 2 3// led灯 4var vol = dac.open({ 5 id: 'voltage', 6 success: function () { 7 console.log('open dac success') 8 }, 9 fail: function () { 10 console.log('open dac failed') 11 } 12}); 13 14vol.writeValue(65536 / 2) 15 16var value = vol.readValue(); 17 18console.log('voltage value is ' + value) 19 20vol.close(); 21 22 23