Closed dmigo closed 6 years ago
Experimenting with hmc5983. It seems to work perfectly with the endpoint for hmc5883l. The only trouble is that some requests return 403 Forbidden. Am I doing something wrong?
hmc5983
hmc5883l
403 Forbidden
Here is the code I use:
const axios = require('axios'); const keyEsp = 'Bearer xxx'; const config = { headers: { 'Authorization': keyEsp } }; let bodyComp = { "SDA": "4", "SCL": "5", "address": "0x3C" }; const urlReadComp = "http://<my.ip>/api/devices/hmc5883l/read"; setInterval(showComp, 1000); function showComp() { axios.post(urlReadComp, bodyComp, config) .then(function (responce) { console.log(responce.data); }).catch(function (error) { console.log("error :", error.message); }); }
Here is the console output:
{ magnetometer: { X: -0.3231, Y: -0.2399, Z: 0.0229 } } { magnetometer: { X: -0.3256, Y: -0.2412, Z: 0.0235 } } { magnetometer: { X: -0.3256, Y: -0.2425, Z: 0.0235 } } error : Request failed with status code 403 { magnetometer: { X: -0.325, Y: -0.2412, Z: 0.0222 } } { magnetometer: { X: -0.3263, Y: -0.238, Z: 0.0248 } } error : Request failed with status code 403 error : Request failed with status code 403
PS Thank you for the awesome firmware!
Apparently this error was indicating problems with I2C bus.
Experimenting with
hmc5983
. It seems to work perfectly with the endpoint forhmc5883l
. The only trouble is that some requests return403 Forbidden
. Am I doing something wrong?Here is the code I use:
Here is the console output:
PS Thank you for the awesome firmware!