Make the test LED actually blink.
This commit is contained in:
+18
-14
@@ -18,18 +18,22 @@ usbInterface.claim();
|
|||||||
var endpointIn = usbInterface.endpoints[0];
|
var endpointIn = usbInterface.endpoints[0];
|
||||||
var endpointOut = usbInterface.endpoints[1];
|
var endpointOut = usbInterface.endpoints[1];
|
||||||
|
|
||||||
var str = '0';
|
var state = '1';
|
||||||
console.log('Sending "%s"', str);
|
|
||||||
endpointOut.transfer(str, function(err) {
|
setInterval(function() {
|
||||||
if (err) {
|
console.log('Sending ', state);
|
||||||
console.error("USB error: %s", err);
|
state = state === '1' ? '0' : '1'
|
||||||
process.exit(1);
|
endpointOut.transfer(state, function(err) {
|
||||||
}
|
if (err) {
|
||||||
endpointIn.transfer(64, function(err2, receivedStr) {
|
console.error("USB error: %s", err);
|
||||||
if (err2) {
|
process.exit(1);
|
||||||
console.error("USB error: %s", err2);
|
|
||||||
process.exit(2);
|
|
||||||
}
|
}
|
||||||
console.log('Received "%s"', receivedStr);
|
endpointIn.transfer(64, function(err2, receivedStr) {
|
||||||
})
|
if (err2) {
|
||||||
});
|
console.error("USB error: %s", err2);
|
||||||
|
process.exit(2);
|
||||||
|
}
|
||||||
|
console.log('Received "%s"', receivedStr);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}, 500)
|
||||||
|
|||||||
Reference in New Issue
Block a user