GlovePIE:Wii fit gas pedals

From WiiLi

Jump to: navigation, search
//created by from-nibly 2008
//distribute and modify this code as much as you want


//to calibrate the wii fit on this script
//just press the wii fit button where it says power



'-------------------IMPORTANT-------------------'
//before you use this make sure the wii fit board
//is right side up so you can read wii correctly









//key setup
if var.both = false then
key.period = var.break
key.comma = var.gas
endif

if var.both = true then
key.period = true
key.comma = true
endif

//just for kicks and notification that glovepie is running
wiimote.balanceboard.LED = true


//if you have both feet on the board it presses both buttons

if var.gas = true and var.tFL > 1.9 then
var.both = true
endif

if var.break = true and var.tFR > 1.9 then
var.both = true
endif

if var.tFR <1.9 or var.tFL < 1.9 then
var.both = false
endif

//so you only press one at a time when you only have one foot on
//if you want it to be more or less sensitive then change what 
//var.tFR or var.tFL needs to be greater than
//ie 1.5 for more pressure needed or .5 for less pressure needed

if var.tFR > var.tFL and var.tFR > 1 then
var.gas = true
else
var.gas = false
endif

if var.tFL > var.tFR and var.tFL > 1 then
var.break = true
else
var.break = false
endif


//tells you what your pressing

if var.gas = true then
debug = "GAS"
endif

if var.break = true then
debug = "BREAK"
endif

var.fBL = wiimote.BalanceBoard.BackLeft
var.fBR = wiimote.BalanceBoard.Frontleft
var.fFL = wiimote.BalanceBoard.BackRight
var.fFR = wiimote.BalanceBoard.FrontRight

//calibration no need to fuss over this when you press the wiifit
//button it simply sets all the var.t** variables to zero
//in more mathmatical terms change = current - initial

if wiimote.BalanceBoard.Button = true then
var.check = true
endif

if var.check = true then
var.cBL = wiimote.BalanceBoard.BackLeft
var.cBR = wiimote.BalanceBoard.FrontLeft
var.cFL = wiimote.BalanceBoard.Backright
var.cFR = wiimote.BalanceBoard.FrontRight
endif

if var.check = true then
var.check = false
endif

var.tBL = var.fBL - var.cBL
var.tBR = var.fBR - var.cBR
var.tFL = (var.fFL - var.cFL) * -1
var.tFR = var.fFR - var.cFR

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