1 2/* 3Please add this section into app.json when run this script as app.js. 4This configuration is designed for haas100 edu k1. 5 { 6 "version": "1.0.0", 7 "io": { 8 "DS18B20": { 9 "type": "GPIO", 10 "port": 4, 11 "dir": "output", 12 "pull": "pullup" 13 } 14 }, 15 "debugLevel": "DEBUG" 16 } 17*/ 18 19console.log('testing DS18B20...'); 20 21var DS18B20 = require('./DS18B20.js'); 22 23DS18B20.init("DS18B20"); 24 25var temperature; 26var count = 10; 27 28while(1) 29{ 30 temperature = DS18B20.getTemperature(); 31 32 { 33 console.log("Temperature is: " , temperature); 34 } 35} 36 37DS18B20.deinit(); 38console.log("test DS18B20 success!"); 39 40