I know this has been asked, and I did search but couldn't find a similar case,so I decided to ask this question again.
Can anyone tell me whats the issue in here, because the first two Axis-X and Axis-Y work perfect but its the Axis-Z that gives me the
"Cannot set property 'nodeValue' of null"
error on my website.
The exact issue I face is that the first two, Axis-X and Axis-Y do pass the values without a problem, and only Axis-Z gives me the error above, my question is, why does it give me that error, and why is it only this one and not all 3 of them.
Just to note, msg.payload in the Axis-Z if statement, does carry a value that its suppose to.
Here is the Javascript:
if (index.contains('Gyroscope')) { //Get all data from Gyroscope queue
if((index.indexOf('Axis-X')) >= 0){//X-Axis queue && 'X-Axis'
// var sendData1 = msg.payload;
// printText("gyrX", sendData1); //Publish data to the textArea
// //console.log("I send Axis-X");
document.getElementById('gyrX').firstChild.nodeValue = msg.payload;
};
if((index.indexOf('Axis-Y')) >= 0){
// var sendData1 = msg.payload;
// printText("gyrY", sendData1); //Publish data to the textArea
// //console.log("I send Axis-Y");
document.getElementById('gyrY').firstChild.nodeValue = msg.payload;
};
if((index.indexOf('Axis-Z')) >= 0){
//var sendData1 = msg.payload;
//printText("gyrZ", msg.payload); //Publish data to the textArea
console.log("I send Axis-Z" + msg.payload);
document.getElementById('gyrZ').firstChild.nodeValue = msg.payload;
};
};
Here is the jade:
main.hoc.container.clear(styles='width:100%;')
.sidebar.four_quarter.first(styles='width:30%;')
table
tr
th(colspan='4') Gyroscope Readings
tr
td(style='width:50%;') Gyroscope X:
td(style='width:50%;')
span#gyrX
tr
td(style='width:50%;') Gyroscope Y:
td(style='width:50%;')
span#gyrY
tr
td(style='width:50%;') Gyroscope Z:
td(style='width:50%;')
span#gyrZ
p
| Note: Sensor accuracy at current configuration can have a difference of 5 degree, calibration is needed.
p
| Note: Sensor takes the angle it was turned on at as 0 degree, make sure that everything is leveled before turning system on.
br
I simplified the code before coming here, thats why alot is commented out.Also, could someone explain to me, why this happened?