mirror of
https://github.com/eclipse/upm.git
synced 2025-07-01 17:31:13 +03:00
adc121c021: python example and JS modification for adc121c021 analog/digital converter
Signed-off-by: Zion Orent <zorent@ics.com> Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:

committed by
Mihai Tudor Panu

parent
7b0dce0992
commit
4ab6873a42
@ -33,7 +33,7 @@ var I2CAddr = I2C_ADC.ADC121C021_DEFAULT_I2C_ADDR;
|
||||
var myI2C_ADC = new I2C_ADC.ADC121C021(busID, I2CAddr);
|
||||
|
||||
// get the data every 50 milliseconds
|
||||
setInterval(function()
|
||||
var myInterval = setInterval(function()
|
||||
{
|
||||
var val = myI2C_ADC.value();
|
||||
var voltsVal = myI2C_ADC.valueToVolts(val);
|
||||
@ -44,6 +44,10 @@ setInterval(function()
|
||||
// Print message when exiting
|
||||
process.on('SIGINT', function()
|
||||
{
|
||||
clearInterval(myInterval);
|
||||
myI2C_ADC = null;
|
||||
I2C_ADC.cleanUp();
|
||||
I2C_ADC = null;
|
||||
console.log("Exiting...");
|
||||
process.exit(0);
|
||||
});
|
||||
|
Reference in New Issue
Block a user