NJKen
August 5th, 2008, 06:42 PM
You can now use your Wiimotes from Girder using a modified version of GenericHID!
I'm hoping that someone in the Girder community with more Lua experience will be able to figure out how to write data to these devices so that we'll have access to the Wiimote's more interesting functions. I'd love to carry my Wiimote with me into another room and then have it's speaker beep me when Girder wants to notify me. I've tried the "Transport Send" action but it doesn't appear to work in my Vista Ultimate x64 environment. As an example, I expect that sending the following hex sequence should activate the rumble: "111301"
---
Required Software and Hardware:
•One or more Nintendo Wii Wiimotes (wireless remote controls)
•Functional Bluetooth hardware and driver software
•Girder 5.x
•The included WiimoteHID.lua file.
---
What You'll Be Able To Do With Your Wiimote and Girder:
•You can trigger 11 unique Girder events wirelessly from each Wiimote.
•You can connect multiple Wiimotes which can either trigger common or separate events.
•Theoretically connect up to the Bluetooth piconet maximum of 7 Wiimotes.
---
Note: Do not plug in a Nunchuck or other accessory or else you'll be forced to turn off and reconnect your Wiimote. This quirk can be corrected once we're able to write to the Wiimotes.
---
Installation:
•The included file WiimoteHID.lua should be placed in the following folder (or modified if you have an alternate default directory)
C:\Program Files\Promixis\Girder5\luascript\Classes\Transport
•You'll need to setup and "pair" each Wiimote with your Bluetooth hardware. This varies depending on the type of Bluetooth software (also called "stack") you have installed. First, check for a Bluetooth icon in your Control Panel or in your system tray. You'll need to tell the Bluetooth software to search for new devices while HOLDING DOWN the 1 and 2 buttons. This method is preferred to holding down the little red button within the battery compartment. Continue to hold down 1 and 2 while answering all of the software prompts. If asked, do NOT assign a password to this connection. The blue LEDs on the Wiimote will NOT stop flashing once this is successful so the only way you know it worked is if the software says "connected" or if Girder is able to connect.
•Activate a connection to the Wiimote from Girder. The "Wiimote Sample Actions.gml" file has a scripting action named "Start Wiimote" which will allow Girder to begin generating events for each button you press on your Wiimote. There is a "GirderOpen" event tied to this action which is disabled by default but can be used to attempt to make this connection each time Girder starts. You can create your own scripting action by copy-and-pasting the following code:
local WiimoteHID = require('Classes.Transport.WiimoteHID')
Wiimote1 = WiimoteHID:New( { VendorID = 1406, ProductID = 774, Index = 0, EventDevice=18, EventPrefix = 'Wiimote1:', Debug = 0 })
•Your Wiimote should stay connected for up to a half hour when idle or longer depending on your Bluetooth software. We'll be able to extend this once we can write to the device from Girder.
•Depending on your Bluetooth Stack you may need to re-connect the Wiimote each time you turn it on unless your Bluetooth Stack can be configured to automatically pair with the Wiimote. I have found that my Bluetooth stack remembers by Wiimotes and allows Girder to pretend to connect to them when they might not actually be on.
---
What You CAN'T Do:
•The power button can't be used to trigger Girder - it only controls the power state of the Wiimote.
•You can't use the rumble feature, make sound come out of the speaker, or use the Wiimote as a pointer. I look forward to the day when we'll be able to make the Wiimote make a short rumble with each button-press to provide some "force feedback".
•You can't change the player LED's on the Wiimote from within Girder. (Yes, I know the flashing can get annoying, but we can fix this as soon as someone can figure out a way to write to a HID device through Lua.)
•You can't read the state from accessory devices such as the Nunchuck, Classic Controller, Wii Guitar, or the Wii Balance Board. Doing this requires that we first write to the Wiimote.
•The keydown, keyup, and repeat modifiers are not yet supported.
•Only individual button-presses will generate events. Pressing multiple buttons at the same time may generate multiple events for each of the keys pressed. If you need to support multiple simultaneous button-presses read the comments in the following section.
---
Simultaneous Button-Presses:
•Properly handling multiple simultaneous button-presses will require additional programming. However, I've provided a simple work-around if you are willing to accept one catch. Setup the Wiimote connection using the option "Raw = 1" as shown in the following commands:
-- Instruct Girder to send "Raw" events instead of "Formatted" ones
local WiimoteHID = require('Classes.Transport.WiimoteHID')
Wiimote1 = WiimoteHID:New( { VendorID = 1406, ProductID = 774, Index = 0, EventDevice=18, EventPrefix = 'Wiimote1:', Debug = 0, Raw = 1 })
This Raw mode generates different events which expose the actual hex values reported by the device. The problem with this work-around is that pressing "A" and "B" at the same time will likely generate both an "A" event and an "A+B" event because one of the buttons was pressed a split second before the pair was pressed. If you must use this mode you should ignore the individual button presses or devise another way to work around this.
---
I hope you enjoy using your Wiimote from within Girder! Please post your experiences in the thread that this file originated from.
---
See the Wiimote Read Me.txt file for links to additional resources.
---
Revision: 08/05/08
I'm hoping that someone in the Girder community with more Lua experience will be able to figure out how to write data to these devices so that we'll have access to the Wiimote's more interesting functions. I'd love to carry my Wiimote with me into another room and then have it's speaker beep me when Girder wants to notify me. I've tried the "Transport Send" action but it doesn't appear to work in my Vista Ultimate x64 environment. As an example, I expect that sending the following hex sequence should activate the rumble: "111301"
---
Required Software and Hardware:
•One or more Nintendo Wii Wiimotes (wireless remote controls)
•Functional Bluetooth hardware and driver software
•Girder 5.x
•The included WiimoteHID.lua file.
---
What You'll Be Able To Do With Your Wiimote and Girder:
•You can trigger 11 unique Girder events wirelessly from each Wiimote.
•You can connect multiple Wiimotes which can either trigger common or separate events.
•Theoretically connect up to the Bluetooth piconet maximum of 7 Wiimotes.
---
Note: Do not plug in a Nunchuck or other accessory or else you'll be forced to turn off and reconnect your Wiimote. This quirk can be corrected once we're able to write to the Wiimotes.
---
Installation:
•The included file WiimoteHID.lua should be placed in the following folder (or modified if you have an alternate default directory)
C:\Program Files\Promixis\Girder5\luascript\Classes\Transport
•You'll need to setup and "pair" each Wiimote with your Bluetooth hardware. This varies depending on the type of Bluetooth software (also called "stack") you have installed. First, check for a Bluetooth icon in your Control Panel or in your system tray. You'll need to tell the Bluetooth software to search for new devices while HOLDING DOWN the 1 and 2 buttons. This method is preferred to holding down the little red button within the battery compartment. Continue to hold down 1 and 2 while answering all of the software prompts. If asked, do NOT assign a password to this connection. The blue LEDs on the Wiimote will NOT stop flashing once this is successful so the only way you know it worked is if the software says "connected" or if Girder is able to connect.
•Activate a connection to the Wiimote from Girder. The "Wiimote Sample Actions.gml" file has a scripting action named "Start Wiimote" which will allow Girder to begin generating events for each button you press on your Wiimote. There is a "GirderOpen" event tied to this action which is disabled by default but can be used to attempt to make this connection each time Girder starts. You can create your own scripting action by copy-and-pasting the following code:
local WiimoteHID = require('Classes.Transport.WiimoteHID')
Wiimote1 = WiimoteHID:New( { VendorID = 1406, ProductID = 774, Index = 0, EventDevice=18, EventPrefix = 'Wiimote1:', Debug = 0 })
•Your Wiimote should stay connected for up to a half hour when idle or longer depending on your Bluetooth software. We'll be able to extend this once we can write to the device from Girder.
•Depending on your Bluetooth Stack you may need to re-connect the Wiimote each time you turn it on unless your Bluetooth Stack can be configured to automatically pair with the Wiimote. I have found that my Bluetooth stack remembers by Wiimotes and allows Girder to pretend to connect to them when they might not actually be on.
---
What You CAN'T Do:
•The power button can't be used to trigger Girder - it only controls the power state of the Wiimote.
•You can't use the rumble feature, make sound come out of the speaker, or use the Wiimote as a pointer. I look forward to the day when we'll be able to make the Wiimote make a short rumble with each button-press to provide some "force feedback".
•You can't change the player LED's on the Wiimote from within Girder. (Yes, I know the flashing can get annoying, but we can fix this as soon as someone can figure out a way to write to a HID device through Lua.)
•You can't read the state from accessory devices such as the Nunchuck, Classic Controller, Wii Guitar, or the Wii Balance Board. Doing this requires that we first write to the Wiimote.
•The keydown, keyup, and repeat modifiers are not yet supported.
•Only individual button-presses will generate events. Pressing multiple buttons at the same time may generate multiple events for each of the keys pressed. If you need to support multiple simultaneous button-presses read the comments in the following section.
---
Simultaneous Button-Presses:
•Properly handling multiple simultaneous button-presses will require additional programming. However, I've provided a simple work-around if you are willing to accept one catch. Setup the Wiimote connection using the option "Raw = 1" as shown in the following commands:
-- Instruct Girder to send "Raw" events instead of "Formatted" ones
local WiimoteHID = require('Classes.Transport.WiimoteHID')
Wiimote1 = WiimoteHID:New( { VendorID = 1406, ProductID = 774, Index = 0, EventDevice=18, EventPrefix = 'Wiimote1:', Debug = 0, Raw = 1 })
This Raw mode generates different events which expose the actual hex values reported by the device. The problem with this work-around is that pressing "A" and "B" at the same time will likely generate both an "A" event and an "A+B" event because one of the buttons was pressed a split second before the pair was pressed. If you must use this mode you should ignore the individual button presses or devise another way to work around this.
---
I hope you enjoy using your Wiimote from within Girder! Please post your experiences in the thread that this file originated from.
---
See the Wiimote Read Me.txt file for links to additional resources.
---
Revision: 08/05/08