Stealth's Nunchuck Wii Mouse

From WiiLi

Jump to: navigation, search
/*
-----------------------------------
- - - - - - - - - - - - - - - - - -
| Nunchuck Wii Mouse by [STEALTH] |
- - - - - - - - - - - - - - - - - -
-----------------------------------

To control the mouse, simply
use the anolog stick.
If you want the cursor to
temporarily go slower, then
hold down the "Z" button
on the Nunchuck while
moving the analog stick.

-----------------------------------
--------- Button Controls ---------
-----------------------------------
The default controls are:

    A = Left Click
    B = Right Click
    Up = Up Arrow Key
    Down = Down Arrow Key
    Left = Left Arrow Key
    Right = Right Arrow Key
    Plus = Volume Up
    Minus = Volume Down
    Home = Windows Key (A.K.A. "Start")
    Z = Slow Cursor
    Analog Stick = Mouse
*/

//Adjust these to you liking.
var.Speed = 50 //Lower = Faster
var.SlowSpeed = 250 //Lower = Faster
var.Limit = 0.004 //Higher = Harder to move
var.LedSpeed = 100 ms //Lower = Faster

//Button controls.
Mouse.LeftButton = Wiimote.A
Mouse.RightButton = Wiimote.B
Key.Up = Wiimote.Up
Key.Down = Wiimote.Down
Key.Left = Wiimote.Left
Key.Right = Wiimote.Right
Key.VolumeUp = Wiimote.Plus
Key.VolumeDown = Wiimote.Minus
Key.Windows = Wiimote.Home

//The "Slow" button.
var.Slow = Wiimote.Nunchuk.ZButton

//The Nuncuck joystick acceleration.
var.JX = Wiimote.Nunchuk.JoyX/var.Speed
var.JY = Wiimote.Nunchuk.JoyY/var.Speed
var.SX = Wiimote.Nunchuk.JoyX/var.SlowSpeed
var.SY = Wiimote.Nunchuk.JoyY/var.SlowSpeed

//Setting the Debug.
debug = "AX = "+var.JX+"  |  "+"AY = "+var.JY+"  |  "+"S = "+var.Slow

//Code to move the mouse.
if (var.Slow){
   Mouse.X += var.SX
   Mouse.Y += var.SY
} else {
   if (var.JX > var.Limit OR var.JX < -var.Limit ){
      Mouse.X += var.JX
   }
   if (var.JY > var.Limit OR var.JY < -var.Limit ){
      Mouse.Y += var.JY
   }
}

//The Leds' code.
if (0 = 0) {
   if (var.Led = 0) {
      Wiimote.Leds = 1
   }
   if (var.Led = 1) {
      Wiimote.Leds = 2
   }
   if (var.Led = 2) {
      Wiimote.Leds = 4
   }
   if (var.Led = 3) {
      Wiimote.Leds = 8
   }
   if (var.Led = 4) {
      Wiimote.Leds = 4
   }
   if (var.Led = 5) {
      Wiimote.Leds = 2
   }
   if (var.Led = 6) {
      Wiimote.Leds = 1
   }
   wait var.LedSpeed
   var.Led = (var.Led + 1) % 6
}
Personal tools
Online Casino - best online casino reviews.
Facebook Developers - facebook applications, facebook developers, facebook development, social network application development and viral widget social media strategy