gus484 Posted September 23, 2015 at 12:07 PM Posted September 23, 2015 at 12:07 PM 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 Quote
photron Posted September 23, 2015 at 12:34 PM Posted September 23, 2015 at 12:34 PM 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); } ); Quote
gus484 Posted September 23, 2015 at 12:46 PM Author Posted September 23, 2015 at 12:46 PM Ok, danke Jetzt funktioniert es. 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.