Dia antes primera install
This commit is contained in:
26
node_modules/i2c-bus/integration-test/sync-deviceid.js
generated
vendored
Normal file
26
node_modules/i2c-bus/integration-test/sync-deviceid.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
'use strict';
|
||||
|
||||
const i2c = require('../');
|
||||
|
||||
const address = 0x50;
|
||||
const invalid = 0x42;
|
||||
|
||||
const readDeviceId = _ => {
|
||||
const i2c1 = i2c.openSync(42);
|
||||
const id = i2c1.deviceIdSync(address);
|
||||
|
||||
console.log('id for address', '0x' + address.toString(16), id);
|
||||
|
||||
//
|
||||
try {
|
||||
i2c1.deviceIdSync(invalid);
|
||||
} catch(e) {
|
||||
i2c1.closeSync();
|
||||
return;
|
||||
}
|
||||
|
||||
throw Error('should have exited though catch');
|
||||
};
|
||||
|
||||
readDeviceId();
|
||||
|
||||
Reference in New Issue
Block a user