Jump to content
View in the app

A better way to browse. Learn more.

Tinkerunity

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Geschrieben

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

 

Geschrieben
  • Autor

Funktioniert damit wunderbar, ich danke dir!

Join the conversation

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

Gast
Reply to this topic...

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.