mkaster Posted December 17, 2019 at 01:52 PM Posted December 17, 2019 at 01:52 PM Moin, Ich habe heute das Bricklet in Betrieb genommen und im BrickViewer läuft alles gut. Wenn ich allerdings versuche die Spotmeter-Statistics über die API abzurufen, bekomme ich leider einen Fehler: RangeError: Index out of range at checkOffset (buffer.js:970:11) at Buffer.readUInt8 (buffer.js:1008:5) at IPConnection.__dirname.IPConnection.unpack (C:\Users\Max\Desktop\TestNoble\node_modules\tinkerforge\lib\IPConnection.js:751:60) at IPConnection.__dirname.IPConnection.handleResponse (C:\Users\Max\Desktop\TestNoble\node_modules\tinkerforge\lib\IPConnection.js:1109:44) at IPConnection.__dirname.IPConnection.handlePacket (C:\Users\Max\Desktop\TestNoble\node_modules\tinkerforge\lib\IPConnection.js:1339:18) at IPConnection.__dirname.IPConnection.handleIncomingData (C:\Users\Max\Desktop\TestNoble\node_modules\tinkerforge\lib\IPConnection.js:378:18) at emitOne (events.js:115:13) at Socket.emit (events.js:210:7) at addChunk (_stream_readable.js:266:12) at readableAddChunk (_stream_readable.js:253:11) Hat jemand eine Idee, was ich falsch mache und könnte mir ein Beispiel für einen funktionierenden Aufruf geben? Besten Dank, Max PS: Versucht habe ich es mit diesem Script: var Tinkerforge = require('tinkerforge'); var HOST = 'localhost'; var PORT = 4223; var UID = 'Lem'; // Change XYZ to the UID of your Thermal Imaging Bricklet var ipcon = new Tinkerforge.IPConnection(); // Create IP connection var ti = new Tinkerforge.BrickletThermalImaging(UID, ipcon); // Create device object ipcon.connect(HOST, PORT, function (error) { console.log('Error: ' + error); } ); // Connect to brickd // Don't use device before ipcon is connected ipcon.on(Tinkerforge.IPConnection.CALLBACK_CONNECTED, function (connectReason) { ti.setSpotmeterConfig([40,30,79,59]); ti.getStatistics(function(sms) { console.log(sms); }); }); console.log('Press key to exit'); process.stdin.on('data', function (data) { ipcon.disconnect(); process.exit(0); } ); Quote
rtrbt Posted December 18, 2019 at 09:12 AM Posted December 18, 2019 at 09:12 AM Moin, Teste das mal mit der angehangenen Version der Bindings (habe mal die Zip und das gepackte Node-Package angehangen). Das Entpacken von bool-Arrays war anscheinend etwas verbuggt. tinkerforge_javascript_bindings_2_1_25.zip tinkerforge-2.1.25.tgz 1 Quote
mkaster Posted December 18, 2019 at 11:54 AM Author Posted December 18, 2019 at 11:54 AM Funktioniert damit wunderbar, ich danke dir! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.