GlovePIE code for Wii-mote mouse emmulation
Here is my code that I used to bind keys to my wii remote to emmulate the mouse function:
// Keybind for Wiimote If var.on then mouse.x = (2 - Wiimote.dot1x / 1023 - Wiimote.dot2x / 1023)/2 mouse.y = (Wiimote.dot1y / 1023 + Wiimote.dot2y / 1023)/2 endif Mouse.LeftButton = Wiimote.A Mouse.RightButton = Wiimote.B Up = Wiimote.Up Down = Wiimote.Down Left = Wiimote.Left Right = Wiimote.Right
// LEDs Wiimote.Led1 = var.on Wiimote.Led2 = TRUE Wiimote.Led3 = TRUE Wiimote.Led4 = var.on
// Keys for Nunchuk var.joyfix = 5 / 100 Mouse.LeftButton = Wiimote.Nunchuk.CButton // C = left mouse click Mouse.RightButton = Wiimote.Nunchuk.ZButton // Z = right mouse click if (Wiimote.Nunchuk.JoyX > var.joyfix or Wiimote.Nunchuk.JoyX < -var.joyfix) then mouse.x = mouse.x + Wiimote.Nunchuk.JoyX/50 // {Analog is used if (Wiimote.Nunchuk.JoyY > var.joyfix or Wiimote.Nunchuk.JoyY < -var.joyfix) then mouse.y = mouse.y + Wiimote.Nunchuk.JoyY/50 // for mouse movement} // Battery info if Wiimote.Battery <= 12 and var.warned == FALSE then Say "Low Battery" var.warned = TRUE endif var.bat = Wiimote.Battery / 192 * 100 debug ='Battery= '+var.bat+'%'
















