node-red-contrib-sensor-rotation-to-phrase
Advanced tools
Comparing version
@@ -26,2 +26,7 @@ /** | ||
if (msg && msg.payload && msg.payload.d) { | ||
// If data has come from an Android Bridge then | ||
// the motion will be on acc_x, acc_y, accel_z | ||
if (msg.payload.d.acc_x) { | ||
androidSource(msg); | ||
} | ||
if (! msg.payload.d.accelX || | ||
@@ -38,2 +43,8 @@ ! msg.payload.d.accelY || | ||
function androidSource(msg) { | ||
msg.payload.d.accelX = msg.payload.d.acc_x || 0; | ||
msg.payload.d.accelY = msg.payload.d.acc_y || 0; | ||
msg.payload.d.accelZ = msg.payload.d.acc_z || 0; | ||
} | ||
// Sensitivity is used to determine how much of a rotational | ||
@@ -40,0 +51,0 @@ // reading is to be detected as a motion. |
{ | ||
"name": "node-red-contrib-sensor-rotation-to-phrase", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "A node to interpret sensor rotation as phrases", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
@@ -20,3 +20,3 @@ # Node-RED Contrib Sensor Rotation to Phrase | ||
```` | ||
as | ||
as from an iOS bridge | ||
```` | ||
@@ -27,2 +27,8 @@ msg.payload.d.accelX | ||
```` | ||
or if from an Android bridge | ||
```` | ||
msg.payload.d.acc_x | ||
msg.payload.d.acc_y | ||
msg.payload.d.acc_z | ||
```` | ||
@@ -29,0 +35,0 @@ ### Calibration |
38307
1.33%308
3.36%96
6.67%