mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-03-01 10:37:43 +00:00
Merge a1d00f58ba4c37fcb1c91617c7cfdb4ddf450467 into 36ac3817a7f5999422c2d7f050aeb1ecf655ff08
This commit is contained in:
commit
9385743765
hardware/sensorTag
@ -64,6 +64,10 @@
|
|||||||
<label for="node-input-name"><i class="fa fa-tag"></i> Gyroscope</label>
|
<label for="node-input-name"><i class="fa fa-tag"></i> Gyroscope</label>
|
||||||
<input type="checkbox" id="node-input-gyroscope" >
|
<input type="checkbox" id="node-input-gyroscope" >
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
|
<label for="node-input-name"><i class="fa fa-tag"></i> Luxometer</label>
|
||||||
|
<input type="checkbox" id="node-input-lux" >
|
||||||
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-name"><i class="fa fa-tag"></i> Keys</label>
|
<label for="node-input-name"><i class="fa fa-tag"></i> Keys</label>
|
||||||
<input type="checkbox" id="node-input-keys" >
|
<input type="checkbox" id="node-input-keys" >
|
||||||
@ -108,6 +112,7 @@
|
|||||||
magnetometer: {value:true},
|
magnetometer: {value:true},
|
||||||
accelerometer: {value:true},
|
accelerometer: {value:true},
|
||||||
gyroscope: {value:true},
|
gyroscope: {value:true},
|
||||||
|
lux: {value:true},
|
||||||
keys: {value:true}
|
keys: {value:true}
|
||||||
},
|
},
|
||||||
inputs:0, // set the number of inputs - only 0 or 1
|
inputs:0, // set the number of inputs - only 0 or 1
|
||||||
|
@ -30,6 +30,7 @@ function sensorTagNode(n) {
|
|||||||
this.accelerometer = n.accelerometer;
|
this.accelerometer = n.accelerometer;
|
||||||
this.magnetometer = n.magnetometer;
|
this.magnetometer = n.magnetometer;
|
||||||
this.gyroscope = n.gyroscope;
|
this.gyroscope = n.gyroscope;
|
||||||
|
this.lux = n.lux; // supported in sensortag 2
|
||||||
this.keys = n.keys;
|
this.keys = n.keys;
|
||||||
|
|
||||||
if (this.uuid === "") {
|
if (this.uuid === "") {
|
||||||
@ -87,6 +88,12 @@ function sensorTagNode(n) {
|
|||||||
msg.payload = {'x': x, 'y': y, 'z': z};
|
msg.payload = {'x': x, 'y': y, 'z': z};
|
||||||
node.send(msg);
|
node.send(msg);
|
||||||
});
|
});
|
||||||
|
sensorTag.enableLux(function(){});
|
||||||
|
sensorTag.on('LuxChange', function(lux){ // should be luxChange
|
||||||
|
var msg = {'topic': node.topic + '/lux'};
|
||||||
|
msg.payload = {'lux': lux};
|
||||||
|
node.send(msg);
|
||||||
|
});
|
||||||
sensorTag.on('simpleKeyChange', function(left, right){
|
sensorTag.on('simpleKeyChange', function(left, right){
|
||||||
var msg = {'topic': node.topic + '/keys'};
|
var msg = {'topic': node.topic + '/keys'};
|
||||||
msg.payload = {'left': left, 'right': right};
|
msg.payload = {'left': left, 'right': right};
|
||||||
@ -133,6 +140,11 @@ function enable(node) {
|
|||||||
} else {
|
} else {
|
||||||
node.stag.unnotifyGyroscope(function() {});
|
node.stag.unnotifyGyroscope(function() {});
|
||||||
}
|
}
|
||||||
|
if (node.lux) {
|
||||||
|
node.stag.notifyLux(function() {});
|
||||||
|
} else {
|
||||||
|
node.stag.unnotifyLux(function() {});
|
||||||
|
}
|
||||||
if (node.keys) {
|
if (node.keys) {
|
||||||
node.stag.notifySimpleKey(function() {});
|
node.stag.notifySimpleKey(function() {});
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user