docs: Removed 'Grove' from Comments

Signed-off-by: Suyash Lakhotia <suyashlakhotia@gmail.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:
Suyash Lakhotia 2016-11-03 10:55:07 +08:00 committed by Mihai Tudor Panu
parent b3991979ad
commit 1aa748e3d6
5 changed files with 126 additions and 134 deletions

View File

@ -22,10 +22,10 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
// Load Grove module // Load UPM module
var ledSensor = require('jsupm_led'); var ledSensor = require('jsupm_led');
// Create the Grove LED object using GPIO pin 2 // Create the LED object using GPIO pin 2
var led = new ledSensor.Led(2); var led = new ledSensor.Led(2);
// Print the name // Print the name

View File

@ -1,31 +1,31 @@
/* /*
* Author: Zion Orent <zorent@ics.com> * Author: Zion Orent <zorent@ics.com>
* Copyright (c) 2014 Intel Corporation. * Copyright (c) 2014 Intel Corporation.
* *
* Permission is hereby granted, free of charge, to any person obtaining * Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the * a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including * "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish, * without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to * distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to * permit persons to whom the Software is furnished to do so, subject to
* the following conditions: * the following conditions:
* *
* The above copyright notice and this permission notice shall be * The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software. * included in all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
//Load Grove Moisture module //Load UPM module
var moisture = require('jsupm_moisture'); var moisture = require('jsupm_moisture');
// Instantiate a Grove Moisture sensor on analog pin A0 // Instantiate a Moisture sensor on analog pin A0
var myMoistureObj = new moisture.Moisture(0); var myMoistureObj = new moisture.Moisture(0);
// Values (approximate): // Values (approximate):
@ -33,22 +33,20 @@ var myMoistureObj = new moisture.Moisture(0);
// 300-600, sensor in humid soil // 300-600, sensor in humid soil
// 600+, sensor in wet soil or submerged in water // 600+, sensor in wet soil or submerged in water
// Read the value every second and print the corresponding moisture level // Read the value every second and print the corresponding moisture level
setInterval(function() setInterval(function() {
{ var result;
var result; var moisture_val = parseInt(myMoistureObj.value());
var moisture_val = parseInt(myMoistureObj.value()); if (moisture_val >= 0 && moisture_val < 300)
if (moisture_val >= 0 && moisture_val < 300) result = "Dry";
result = "Dry"; else if (moisture_val >= 300 && moisture_val < 600)
else if (moisture_val >= 300 && moisture_val < 600) result = "Moist";
result = "Moist"; else
else result = "Wet";
result = "Wet"; console.log("Moisture value: " + moisture_val + ", " + result);
console.log("Moisture value: " + moisture_val + ", " + result);
}, 1000); }, 1000);
// Print message when exiting // Print message when exiting
process.on('SIGINT', function() process.on('SIGINT', function() {
{ console.log("Exiting...");
console.log("Exiting..."); process.exit(0);
process.exit(0);
}); });

View File

@ -1,51 +1,49 @@
/* /*
* Author: Zion Orent <zorent@ics.com> * Author: Zion Orent <zorent@ics.com>
* Copyright (c) 2014 Intel Corporation. * Copyright (c) 2014 Intel Corporation.
* *
* Permission is hereby granted, free of charge, to any person obtaining * Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the * a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including * "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish, * without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to * distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to * permit persons to whom the Software is furnished to do so, subject to
* the following conditions: * the following conditions:
* *
* The above copyright notice and this permission notice shall be * The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software. * included in all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
var voltageDivider = require('jsupm_vdiv'); var voltageDivider = require('jsupm_vdiv');
// Instantiate a Grove Voltage Divider sensor on analog pin A0 // Instantiate a Voltage Divider sensor on analog pin A0
var myVoltageDivider = new voltageDivider.VDiv(0); var myVoltageDivider = new voltageDivider.VDiv(0);
// collect data and output measured voltage according to the setting // collect data and output measured voltage according to the setting
// of the scaling switch (3 or 10) // of the scaling switch (3 or 10)
var val, gain3val, gain10val; var val, gain3val, gain10val;
function getVoltageInfo()
{ function getVoltageInfo() {
val = myVoltageDivider.value(100); val = myVoltageDivider.value(100);
gain3val = myVoltageDivider.computedValue(3, val); gain3val = myVoltageDivider.computedValue(3, val);
gain10val = myVoltageDivider.computedValue(10, val); gain10val = myVoltageDivider.computedValue(10, val);
console.log("ADC value: " + val + " Gain 3: " + gain3val console.log("ADC value: " + val + " Gain 3: " + gain3val + "v Gain 10: " + gain10val + "v");
+ "v Gain 10: " + gain10val + "v");
} }
setInterval(getVoltageInfo, 1000); setInterval(getVoltageInfo, 1000);
// Print message when exiting // Print message when exiting
process.on('SIGINT', function() process.on('SIGINT', function() {
{ myVoltageDivider = null;
myVoltageDivider = null; voltageDivider.cleanUp();
voltageDivider.cleanUp(); voltageDivider = null;
voltageDivider = null; console.log("Exiting...");
console.log("Exiting..."); process.exit(0);
process.exit(0);
}); });

View File

@ -22,25 +22,23 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
// Load Grove module // Load UPM module
var waterSensor = require('jsupm_water'); var waterSensor = require('jsupm_water');
// Instantiate a Water sensor on digital pin D2 // Instantiate a Water sensor on digital pin D2
var water = new waterSensor.Water(2); var water = new waterSensor.Water(2);
// Read whether the sensor is wet/dry, waiting one second between readings // Read whether the sensor is wet/dry, waiting one second between readings
function readWaterState() function readWaterState() {
{ if (water.isWet())
if (water.isWet()) console.log("Sensor is wet");
console.log("Sensor is wet"); else
else console.log("Sensor is dry");
console.log("Sensor is dry");
} }
setInterval(readWaterState, 1000); setInterval(readWaterState, 1000);
// Print message when exiting // Print message when exiting
process.on('SIGINT', function() process.on('SIGINT', function() {
{ console.log("Exiting...");
console.log("Exiting..."); process.exit(0);
process.exit(0);
}); });

View File

@ -1,30 +1,30 @@
/* /*
* Author: Zion Orent <zorent@ics.com> * Author: Zion Orent <zorent@ics.com>
* Copyright (c) 2015 Intel Corporation. * Copyright (c) 2015 Intel Corporation.
* *
* Permission is hereby granted, free of charge, to any person obtaining * Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the * a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including * "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish, * without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to * distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to * permit persons to whom the Software is furnished to do so, subject to
* the following conditions: * the following conditions:
* *
* The above copyright notice and this permission notice shall be * The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software. * included in all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
var waterFlow_lib = require('jsupm_wfs'); var waterFlow_lib = require('jsupm_wfs');
// Instantiate a Grove Water Flow Sensor on digital pin D2 // Instantiate a Water Flow Sensor on digital pin D2
var myWaterFlow_obj = new waterFlow_lib.WFS(2); var myWaterFlow_obj = new waterFlow_lib.WFS(2);
// set the flow counter to 0 and start counting // set the flow counter to 0 and start counting
@ -33,34 +33,32 @@ myWaterFlow_obj.startFlowCounter();
var millis, flowCount, fr; var millis, flowCount, fr;
var myInterval = setInterval(function() var myInterval = setInterval(function() {
{ // we grab these (millis and flowCount) just for display
// we grab these (millis and flowCount) just for display // purposes in this example
// purposes in this example millis = myWaterFlow_obj.getMillis();
millis = myWaterFlow_obj.getMillis(); flowCount = myWaterFlow_obj.flowCounter();
flowCount = myWaterFlow_obj.flowCounter();
fr = myWaterFlow_obj.flowRate(); fr = myWaterFlow_obj.flowRate();
// output milliseconds passed, flow count, and computed flow rate // output milliseconds passed, flow count, and computed flow rate
outputStr = "Millis: " + millis + " Flow Count: " + flowCount + outputStr = "Millis: " + millis + " Flow Count: " + flowCount +
" Flow Rate: " + fr + " LPM"; " Flow Rate: " + fr + " LPM";
console.log(outputStr); console.log(outputStr);
// best to gather data for at least one second for reasonable // best to gather data for at least one second for reasonable
// results. // results.
}, 2000); }, 2000);
// When exiting: clear interval and print message // When exiting: clear interval and print message
process.on('SIGINT', function() process.on('SIGINT', function() {
{ clearInterval(myInterval);
clearInterval(myInterval); myWaterFlow_obj.stopFlowCounter();
myWaterFlow_obj.stopFlowCounter(); myWaterFlow_obj = null
myWaterFlow_obj = null waterFlow_lib.cleanUp();
waterFlow_lib.cleanUp(); waterFlow_lib = null;
waterFlow_lib = null;
console.log("Exiting"); console.log("Exiting");
process.exit(0); process.exit(0);
}); });