Discuss Scratch
- Discussion Forums
- » Developing Scratch Extensions
- » HID XBox Controller Extension
- 4tronix
- New to Scratch
4 posts
HID XBox Controller Extension
I am developing an extension for a new hardware controller and using an XBox 360 controller to test it while there are only a small number of “real” devices. I am using a javascript extension in ScratchX, based on the joystick extension (with updates in the wedo extension) from Shane M. Clements.
The controller is recognised (Green dot) and all the control blocks appear and work correctly. However, no data appears. The rawdata array seems to be completely empty.
If I use the Gamepad navigator class then it all works as it should, but it seems as though no polling is occurring when using the HID interface.
In fact, I have modified the WeDo extension to refer to the XBox controller - again the blocks are there and the green dot appears, but no data can be found.
I have got to assume that someone somewhere has created an extension for the XBox controller using HID, but I cannot find it.
Do I have to do anything special to get the device to be polled?
My browser / operating system: Windows 7, Firefox 39.0, Flash 18.0 (release 0)
My understanding is that this starts the polling:
ext._deviceConnected = function(dev) {
if(device) return;
device = dev;
device.open();
// read n bytes of HID data and poll every 100ms
poller = setInterval(function() {
device.read(function(data) {
input = data;
});
}, 20);
};
The controller is recognised (Green dot) and all the control blocks appear and work correctly. However, no data appears. The rawdata array seems to be completely empty.
If I use the Gamepad navigator class then it all works as it should, but it seems as though no polling is occurring when using the HID interface.
In fact, I have modified the WeDo extension to refer to the XBox controller - again the blocks are there and the green dot appears, but no data can be found.
I have got to assume that someone somewhere has created an extension for the XBox controller using HID, but I cannot find it.
Do I have to do anything special to get the device to be polled?
My browser / operating system: Windows 7, Firefox 39.0, Flash 18.0 (release 0)
My understanding is that this starts the polling:
ext._deviceConnected = function(dev) {
if(device) return;
device = dev;
device.open();
// read n bytes of HID data and poll every 100ms
poller = setInterval(function() {
device.read(function(data) {
input = data;
});
}, 20);
};
- PizzamanGaming
- Scratcher
28 posts
HID XBox Controller Extension
That sounds cool
follow my ZombieHunter forums page to ask about any questions about ZombieHunter
https://scratch.mit.edu/discuss/topic/141874/
Or follow my Chromacry forums and make suggestions here —-> https://scratch.mit.edu/discuss/topic/142180/
You can't handle my swagness
- Discussion Forums
- » Developing Scratch Extensions
- » HID XBox Controller Extension