123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
-
-
-
-
-
-
- var GP2Y0A_AREF = 5.0;
- var SAMPLES_PER_QUERY = 20;
-
- var IRProximity = require('jsupm_gp2y0a');
-
-
-
-
-
- var myVolts = new IRProximity.GP2Y0A(1);
-
-
-
-
-
- var myInterval = setInterval(function()
- {
- console.log("AREF: " + GP2Y0A_AREF +
- ", Voltage value (higher means closer): " +
- myVolts.value(GP2Y0A_AREF, SAMPLES_PER_QUERY));
- }, 1000);
-
-
- process.on('SIGINT', function()
- {
- clearInterval(myInterval);
- myVolts = null;
- IRProximity.cleanUp();
- IRProximity = null;
- console.log("Exiting...");
- process.exit(0);
- });
|