Cylon Battery

From WiiLi

Jump to: navigation, search
 //made by Chaorain
//Contact me at Chaorain@Gmail.com

//Script based on the following
//Cylon script based on part of the following
        //Mouse Control Script using IR
        //by vkapadia with much assistance from inio
        //vkapadia@vkapadia.com
//Battery level script based on sthe following
          //Wiimote Battery Display
          //by J.Coulston
          // Modified by Carl Kenner for GlovePIE 0.25

//A full battery gives 0xC0 (192)
var.Batt = wiimote.Battery / 48
Var.Battery = 100*wiimote.Battery/192
var.KITTspeed = 100 ms //delay speed for flashing LEDs. higher = slower

if True then
wait 5 seconds
//it sends an instruction that tells the Wiimote to actually
//send the report.
Wiimote.Report15 = 0x80 | Int(wiimote.Rumble)
end if

debug = "Battery level: " + 100*48*var.Batt/192 + "%"

//5% Battery Alarm  1 LEDs plus Speaker alarm

if 0 < Var.Battery <= 5

       if 0 = 0 then
              if var.kitt = 0 then
                 wiimote.Leds = 1
                 wiimote.frequency = 3640
                 wiimote.Volume = 2
              endif

              if var.kitt = 1 then
                 wiimote.leds = 0
              endif

              wait var.KITTspeed

              var.kitt = (var.kitt + 1) % 3

       endif

// Battery less than 1/4  1 LEDs

elseif 5 < Var.Battery <= 25 then

       if 0 = 0 then
              if var.kitt = 0 then
                 wiimote.Leds = 1
              endif

              if var.kitt = 1 then
                 wiimote.leds = 0
              endif

              wait var.KITTspeed

              var.kitt = (var.kitt + 1) % 3

       endif

//Battery about 1/4 +    2 LEDs

elseif 25 < Var.Battery <= 50 then

       if 0 = 0 then
              if var.kitt = 0 then
                 wiimote.Leds = 1
              endif

              if var.kitt = 1 then
                 wiimote.Leds = 3
              endif

              if var.kitt = 2 then
                 wiimote.Leds = 2
              endif

              if var.kitt = 3 then
                 wiimote.Leds = 3
              endif

              wait var.KITTspeed

              var.kitt = (var.kitt + 1) % 4
       endif

//Battery about 1/2 +  3 LEDs

elseif 50 < Var.Battery <= 75 then
       if 0 = 0 then
              if var.kitt = 0 then
                 wiimote.Leds = 1
              endif

              if var.kitt = 1 then
                 wiimote.Leds = 3
              endif

              if var.kitt = 2 then
                 wiimote.Leds = 6
              endif

              if var.kitt = 3 then
                 wiimote.Leds = 4
              endif

              if var.kitt = 4 then
                 wiimote.Leds = 6
              endif

              if var.kitt = 5 then
                 wiimote.Leds = 3
              endif

              wait var.KITTspeed

              var.kitt = (var.kitt + 1) % 6
       endif

//Battery about 3/4 +    4 LEDs

elseif 75 < Var.Battery <= 100 then

       if 0 = 0 then
              if var.kitt = 0 then
                 wiimote.Leds = 1
              endif

              if var.kitt = 1 then
                 wiimote.Leds = 3
              endif

              if var.kitt = 2 then
                 wiimote.Leds = 6
              endif

              if var.kitt = 3 then
                 wiimote.Leds = 12
              endif

              if var.kitt = 4 then
                 wiimote.Leds = 8
              endif

              if var.kitt = 5 then
                 wiimote.Leds = 12
              endif

              if var.kitt = 6 then
                 wiimote.Leds = 6
              endif

              if var.kitt = 7 then
                 wiimote.Leds = 3
              endif

              wait var.KITTspeed

              var.kitt = (var.kitt + 1) % 8
       endif

endif
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