Jump to content
Sign in to follow this  
mkaster

Thermal Imaging Bricklet - NodeJS

Recommended Posts

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);
    }
);

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...