Geschrieben September 23, 2015 at 12:0723. Sep 2015 Hallo, es gelingt mir nicht den Port eines IO16 abzufragen. Ich erhalte jedes Mal als Ergebnis "undefined". Das IO16 wird korrekt erkannt und ich kann es konfigurieren und schalten, nur eben nicht lesen. if (deviceIdentifier == Tinkerforge.BrickletIO16.DEVICE_IDENTIFIER) { debug("Found IO16 with UID:" + uid); io16 = new Tinkerforge.BrickletIO16(uid, ipcon); // Create device object // Alle Pins an Port B auf Ausgang setzen (ausgeschaltet) io16.setPortConfiguration('b', 255, 'o', false); io16.setPort('b', 1); pins = io16.getPort('b'); alert(pins); // bringt undefined" } Ich hoffe ihr könnt mir helfen Gruß gus484
Geschrieben September 23, 2015 at 12:3423. Sep 2015 Getter in den JavaScript Bindings sind async. Du musst getPort so aufrufen: // Get current value from port A as bitmask io.getPort('a', function (valueMask) { alert('Value Mask (Port A): ' + valueMask.toString(2)); }, function (error) { alert('Error: ' + error); } );
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.