phidgetsライブラリを使用して、nodejsを介して物理デバイスと対話しています。すべてが物理的に接続されています。やりたいのは、オン/オフのタイミングが正確であることを確認することだけです。
setTimoutに関してconsole.logoutを正しく取得することすらできないため、これが問題になります。
基本的に、私は次のことを行おうとしています。
for ( var i = 0; i < 4; i++ ) {
setTimeout( function(i){
console.log('Input: "' + i + '", Executed with timeout of ' + i*1000 + 'ms');
}(i), i*1000 );
};
しかし、私のコンソールは、タイムアウトなしで、以下を吐き出します。瞬時です。
Input: "0", Executed with timeout of 0ms
Input: "1", Executed with timeout of 1000ms
Input: "2", Executed with timeout of 2000ms
Input: "3", Executed with timeout of 3000ms
これは私が望むものからはほど遠いです。
何が起こっているのかについて何かアイデアはありますか?