Powered by SmartDoc

�ソスt�ソス^

2009�ソスN4�ソス�ソス14�ソス�ソス�ソスナ終�ソスX�ソスV
�ソス�ソス�ソス�ソスナ彦
http://akihiko.shirai.as/projects/BookWii/

�ソスレ趣ソス

�ソスt�ソス^�ソスFGlovePIE�ソスヨ撰ソス�ソス�ソス�ソスt�ソス@�ソス�ソス�ソス�ソス�ソスX

�ソス�ソス�ソス�ソス�ソスGlovePIE�ソスノ難ソス�ソス�ソス�ソス�ソス�ソス�ソストゑソス�ソス�ソスuDocumentation.rtf�ソスv�ソス�ソスニ趣ソス�ソスノ撰ソス�ソス�ソス�ソス�ソス�ソスネゑソス�ソス�ソス|�ソス�しゑソス�ソス�ソス�ソスフでゑソス�ソスB�ソス�ソス�ソス�ソス�ソス[�ソス�ソス�ソス�ソス�ソスe�ソス�ソス�ソス�ソス�ソス�ソスワゑソス�ソス�ソス�ソス�ソスA�ソス�ソス�ソスミ最新�ソスフオ�ソス�ソス�ソスW�ソスi�ソス�ソス�ソスフ英�ソス�ソスナゑソス�ソスm�ソスF�ソス�ソス�ソス�ソス驍ア�ソスニゑソス�ソス�ソス�ソス�ソス�ソス゚ゑソス�ソスワゑソス�ソスB�ソス�ソスメの包ソス�ソスL�ソス�ソス�ソスm�ソス�ソス�ソスノ奇ソス�ソス�ソス�ソス�ソス�ソスo�ソス�ソス�ソスワゑソス�ソスB

�ソスR�ソス�ソス�ソス�ソス�ソスg�ソスs
�ソスツ読撰ソス�ソス�ソス�ソス�ソス�ソス゚るた�ソス゚のコ�ソス�ソス�ソス�ソス�ソスg�ソスs�ソスナゑソス�ソスB�ソスu//�ソスv�ソスフ托ソス�ソスノ「/*�ソス`*/�ソスv�ソスA�ソスu'�ソスv�ソスA�ソスu%�ソスv�ソスA�ソスuREM�ソスv�ソスナ始�ソスワゑソスs�ソス�ソス�ソスR�ソス�ソス�ソス�ソス�ソスg�ソスニゑソス�ソスト厄ソス�ソス�ソス�ソス�ソス�ソス�ソスワゑソス�ソスB
�ソスs�ソス�ソス
�ソス�ソス�ソス�ソス�ソスt�ソス�ソス�ソス�ソス�ソス�ソス�ソス�ソス�ソスs�ソス�ソス�ソストゑソス�ソス�ソス閧��ソス�ソスワゑソス�ソス�が、C/C++�ソスX�ソス^�ソスC�ソス�ソス�ソスフ「;�ソスv�ソス�ソスt�ソス�ソス�ソス�ソス�ソスト行�ソス�ソス�ソス�明趣ソス�ソスI�ソスノ記�ソスq�ソスナゑソス�ソスワゑソス�ソスB
�ソス�ソス�ソス
�ソスuA=B�ソスv�ソスニゑソス�ソス�ソス�ソスA�ソスフ抵ソス�ソスg�ソス�ソスB�ソスノなゑソスワゑソス�ソスB�ソスuA:=B�ソスv�ソス�ソスuB=>A�ソスv�ソスニゑソス�ソスL�ソスq�ソスナゑソス�ソスワゑソス�ソスB
If�ソス�ソス(�ソス�ソス�ソス�ソス�ソス�ソス�ソス�ソス)
�ソス�ソス{�ソスヘ「if (�ソス�ソス�ソス�ソス) then (�ソス�ソス�ソス�ソス) [;] end if�ソスv�ソスナゑソス�ソス�ソス�ソスuthen�ソスv�ソスヘ省暦ソス�ソスツ能�ソスAend if�ソス�ソス�ソスuend�ソスv�ソスニ擾ソス�ソス�ソス�ソスワゑソス�ソスB�ソスuelse�ソスv�ソス�ソス�ソスg�ソスp�ソスナゑソス�ソスワゑソス�ソスB
while�ソス�ソス(�ソスJ�ソス�ソスヤゑソス�ソス�ソス�ソスs)
�ソスuwhile (�ソス�ソス�ソス�ソス) { (�ソス�ソス�ソス�ソス) }�ソスv�ソスナゑソス�ソスB1�ソスs�ソスナ擾ソス�ソス�ソス�ソス�ソス�ソスニゑソス�ソスナゑソス�ソスワゑソス�ソスB�ソスudo�ソスv�ソス�ソス�ソスg�ソスp�ソスナゑソス�ソスワゑソス�ソスB
For�ソス�ソス(�ソスJ�ソス�ソスヤゑソス�ソス�ソス�ソスs)
for ( (�ソス�ソス�ソス�ソス�ソスl) ; (�ソス�ソス�ソス�ソス) ; (�ソス�ソス�ソス�ソス) ) { (�ソス�ソス�ソス�ソス) }�ソスv�ソスナゑソス�ソスB�ソス�ソス�ソス�ソス�ソスI�ソスノ閉ゑソス�ソス驍ス�ソス゚に「end for�ソスv�ソス�ソス�ソスg�ソス�ソス�ソス�ソス�ソスニゑソス�ソスナゑソス�ソスワゑソス�ソスB
wait�ソス�ソス
�ソス�ソス�ソス�ソス�ソス�ソス�ソスw�ソス闔橸ソスヤゑソス�ソス�ソス�ソス�ソス~�ソスナゑソス�ソスワゑソス�ソスB�ソスuwait 100 ms�ソスv,�ソスuwait 1 second�ソスv,�ソスuwait(500 milliseconds)�ソスv�ソスネど単�ソスハ付�ソス�ソス�ソスナ標�ソスL�ソス�ソス�ソスワゑソス�ソスB
�ソス�ソス�ソスZ/�ソス�ソス�ソスZ
�ソス�ソス�ソスZ�ソスF�ソスuvar.x++�ソスv,�ソスu++var.x�ソスv,�ソスuInc(var.x)�ソスv�ソスA�ソス�ソス�ソスZ�ソスF�ソスuvar.x--�ソスv,�ソスu--var.x�ソスv,�ソスuDec(var.x)�ソスv�ソス�ソス�ソスC�ソス�ソス�ソス�ソス�ソスC�ソス�ソス�ソスナ使�ソスp�ソスナゑソス�ソスワゑソス�ソスB
�ソスr�ソスb�ソスg�ソスV�ソスt�ソスg�ソス�ソス�ソスZ
�ソスushr var.x, 1�ソスv,�ソスushl var.x,1�ソスv�ソスニゑソス�ソス驍ア�ソスニでビ�ソスb�ソスg�ソスV�ソスt�ソスg�ソス�ソス�ソスZ�ソス�ソス�ソス�ソス�ソスs�ソスナゑソス�ソスワゑソス�ソスB
�ソス�ソス�ソス�ソス
�ソスuSay�ソスghello world�ソスh�ソスv�ソス�ソス�ソス�ソス�ソス�ソス�ソスヘ「Say(�ソスghello world�ソスh)�ソスv�ソスニ擾ソス�ソス�ソス�ソス�ソス�ソスニで、�ソス�ソス�ソス�ソス�ソス�ソス�ソス�ソス�ソスナ趣ソス�ソスR�ソスノ抵ソス�ソス轤ケ�ソス驍ア�ソスニゑソス�ソスナゑソス�ソスワゑソス�ソスB

�ソス�ソス�ソス�ソス�ソスト関撰ソス�ソスナゑソス�ソスB

�ソスO�ソスp�ソスヨ撰ソス(trigonometric)�ソスE�ソスt�ソスO�ソスp�ソスヨ撰ソス(Inverse trigonometric)
sin, cos, tan, sec, cosec, cotan, aSin, aCos, aTan, aSec, aCosec, aCotan, atan2
�ソスo�ソスネ撰ソス�ソスヨ撰ソス(Hyperbolic)�ソスE�ソスt�ソスo�ソスネ撰ソス�ソスヨ撰ソス(Inverse Hyperbolic trig.)
SinH, CosH, TanH, SecH, CosecH, CotH, aSinH, aCosH, aTanH, aSecH, aCosecH, aCotanH
�ソスロめ関撰ソス(Rounding Functions)
�ソスuceil()�ソスv�ソスリゑソス繧ー�ソス�ソス�ソス�ソス�ソス�ソス,�ソスufloor()�ソスv�ソスリゑソスフて撰ソス�ソス�ソス�ソス�ソス,�ソスutrunc()/int()�ソスv�ソスリり落�ソスニゑソス�ソス�ソス�ソス�ソス�ソス�ソス,�ソスuround()�ソスv�ソスl�ソスフ五難ソス,�ソスufrac()�ソスv�ソス�ソス�ソス�ソス�ソス�ソス, RoundTo(),SipleRoundTo()
�ソス�ソス�ソス�ソス�ソスヨ撰ソス(Sign Functions)
�ソスuSign()�ソスv�ソス�ソス�ソスネゑソス1�ソスA0�ソスネゑソス0�ソスA�ソス�ソス�ソスネゑソス-1�ソス�ソスヤゑソス�ソスB�ソスuAbs()�ソスv�ソス�ソスホ値�ソスB�ソス�ソス�ソス�ソス�ソス�ソス�ソス�ソス闖懶ソス�ソス�ソスト返ゑソス�ソスB
�ソスw�ソス�ソス�ソスニ包ソス�ソス�ソス�ソス�ソス(Exponential and Square Root)
�ソスusqr(x)�ソスvx�ソスフ難ソス�ソスA�ソスusqrt(x)�ソスv�ソス�ソスx�ソスA�ソスupower(x,y)/intPower(x,y)�ソスvx�ソス�ソスy�ソス�ソスA�ソスuexp(x)�ソスve�ソス�ソスx�ソス�ソス(e=2.71828... e^x�ソスフ費ソス�ソス�ソス�ソス�ソスe^x)�ソスA�ソスuLdexp(s,p)�ソスvs * (2^p)�ソス�ソス�ソスv�ソスZ�ソスB
�ソス�ソス�ソス�ソス�ソス�ソス(polynomial)
�ソスuPoly(x, a0, [a1, [a2, [a3, [a4, [a5, [a6]]]]]])�ソスv�ソス�ソスa0 + a1*x + a2*(x^2) + a3*(x^3) + a4*(x^4) + ...�ソス�ソス�ソスv�ソスZ
�ソスホ撰ソス(Logarithms)
�ソスuLog10(x)�ソスv,�ソスuLog2(x)�ソスv,�ソスuLogN(N, x)�ソスv,�ソスuLn(x)�ソスv,�ソスuLnXP1(x)�ソスvLn(x)�ソスニ難ソス�ソス�ソス�ソスナゑソス�ソス�ソス�ソスiX+1�ソスj�ソスフ趣ソス�ソスR�ソスホ撰ソス�ソス�ソスヤゑソス�ソスB
�ソス�ソスr�ソスヨ撰ソス(Comparison)
�ソスuIsZero(x)�ソスv,�ソスuIsInfinite(x)�ソスv�ソス�ソス�ソス�ソス�ソスネゑソスtrue,�ソスuIsNaN(x)�ソスvx�ソス�ソス�ソス�ソス�ソスl�ソスナなゑソス�ソス�ソス�ソスtrue,�ソスuSameValue(a, b [, c])�ソスva,b�ソス�ソス�ソス�ソス�ソス�ソス(c�ソスネ降�ソス�ソス)�ソスネゑソスtrue,�ソスuInSet(x,a,b,c,d,e,f,g,...)�ソスvx�ソス�ソス�ソスネ鯉ソス�ソスa�ソス`g�ソスノ茨ソスv�ソス�ソス�ソス�ソス�ソスtrue�ソスB
�ソスナ托ソス/�ソスナ擾ソス�ソスヨ撰ソス
�ソスumax(a,b)/min(a,b)�ソスv2�ソスツの値�ソスフ最托ソス/�ソスナ擾ソス�ソス�ソスヤゑソス�ソスA�ソスP�ソスハは保托ソス�ソスB
�ソスl�ソス�ソスヨ撰ソス
�ソスuEnsureRange(x, a, b)�ソスvx�ソス�ソスl�ソス�ソス[a,b]�ソスノ趣ソス�ソス゚ゑソスB�ソスuInRange(x, a, b)�ソスvx�ソス�ソス�ソスl�ソス�ソス[a,b]�ソス�ソス�ソスナゑソス�ソス�ソス�ソスtrue�ソスB
�ソス}�ソスb�ソスv�ソスヨ撰ソス
�ソスuMapRange(x, a, b, c, d)�ソスv�ソスl�ソス�ソス[a,b]�ソスノゑソス�ソス�ソス�ソス�ソスx�ソス�ソスl�ソス�ソス[c,d]�ソスノ奇ソス�ソス闢厄ソストゑソス�ソスl�ソス�ソスヤゑソス�ソスB�ソス}�ソスb�ソスv�ソス繧ェ�ソスl�ソス�ソスフ外�ソスナゑソス�ソス�ソス�ソストゑソス�ソスK�ソス�ソス�ソスネ値�ソスノなゑソスB�ソスuEnsureMapRange(x, a, b, c, d)�ソスvMapRange�ソスニ難ソス�ソス�ソス�ソス�ソス�ソス�ソス�ソスl�ソス�ソスフ外�ソスフ値�ソス�ソスl�ソス�ソスフ端�ソスニゑソス�ソス�ソスB
�ソス�ソス�ソス�ソス(Random)
�ソスuRandom�ソスv0�ソス`1�ソスフ��ソス�ソス�ソス�ソス_�ソス�ソス�ソスネ擾ソス�ソス�ソス�ソスl�ソスB�ソスuRandom(n)�ソスv0�ソス`n-1�ソスワでの��ソス�ソス�ソス�ソス_�ソス�ソス�ソスネ撰ソス�ソスB�ソスuRandomRange(a,b)�ソスva�ソス`b�ソスワでの��ソス�ソス�ソス�ソス_�ソス�ソス�ソスネ撰ソス�ソスB�ソスuRandG(mean, StandDev)�ソスv�ソス�ソス�ソスマのまゑソス�ソスノガ�ソスE�ソスX�ソス�ソス�ソスz�ソス�ソス�ソス逞撰ソス�ソス�ソス�ソスヤゑソス�ソスB
�ソス�ソス�ソス�ソス(Ordinal)
�ソスuodd(n)�ソスv�ソス�数�ソスネゑソスtrue,�ソスupred(n)/succ(n)�ソスv�ソス�ソス�ソスR�ソス�ソスn-1/n+1�ソス�ソスヤゑソス�ソスB
�ソス�ソス�ソスt�ソス�ソス�ソス�ソス�ソスヨ撰ソス
�ソスuNow/Time/Date�ソスv�ソス�ソス�ソスンの難ソス�ソス�ソス,�ソスuTomorrow/Yesterday�ソスv�ソス�ソス�ソス�ソス/�ソス�ソス�ソス�ソスフ難ソス�ソスt,�ソスuCurrentYear�ソスv�ソスO�ソス�ソス�ソスS�ソス�ソス�ソスI�ソス�ソスフ搾ソス�ソスN,�ソスuDateOf(x)/TimeOf(x)�ソスvx�ソスフ難ソス�ソスt/�ソス�ソス�ソス�ソス,�ソスuDayofthemonth(x), dayoftheweek(x), dayoftheyear(x), dayofweek(x), Daysbetween(x, y), Daysinamonth(x, y), daysinayear(x), daysinmonth(x), daysinyear(x), DaySpan(x, y), HourOfTheDay(x), HourOfTheMonth(x), HourOfTheWeek(x), HourOfTheYear(x), HoursBetween(x, y), HourSpan(x, y), IncDay(x, [y])�ソスv�ソス�ソス�ソスフ托ソス�ソス�ソス�ソスt�ソス�ソス�ソス�ソス�ソスヨ撰ソス

�ソス�ソス�ソスフ托ソス�ソスフ関撰ソス

Smooth(x, [ExtraFrames, [DeadbandDistance]])
Smooths�ソスヨ撰ソス�ソスヘ値x�ソス�ソス�ソス゚具ソス�ソス�ソス[ExtraFrames]�ソスフ鯉ソス�ソス�ソス�ソス�ソス�ソス�ソス�ソス�ソス�ソスツゑソス�ソス�ソス�ソスト包ソス�ソスマゑソス�ソスZ�ソスo�ソス�ソス�ソスワゑソス�ソスB�ソス�ソス�ソス�ソス[DeadbandDistance]�ソスネ擾ソスフ変更�ソス�ソス�ソスネゑソス�ソス�ソスホ、�ソスS�ソストにゑソス�ソス�ソス�ソスト変更�ソス�ソス�ソスネゑソス�ソス�ソス�ソス�ソス�ソス�ソス�ソスフとゑソス�ソスト費ソス�ソスf�ソス�ソス�ソスワゑソス(�ソスネ暦ソス�ソス�ソス�ソスフデ�ソスt�ソスH�ソス�ソス�ソスg[DeadbandDistance]�ソス�ソス0)�ソスB
Pressed(x), Clicked(x), SingleClicked(x), DoubleClicked(x)
�ソス�ソス�ソス黷シ�ソス�ソスフイ�ソスx�ソス�ソス�ソスg�ソス�ソス�ソス�ソス�ソス�ソス�ソス�ソス�ソス�ソス�ソスニゑソス�ソス�ソスtrue�ソス�ソスヤゑソス�ソスワゑソス�ソスB
HeldDown(x, MinTime)
x�ソス�ソス�ソス�ソス�ソス�ソス�ソス�ソストゑソス�ソス�ソスヤ、MinTime�ソスフ間ゑソス�ソス�ソスtrue�ソス�ソスヤゑソス�ソスワゑソス�ソスB
KeepDown(x, MinTime)
MinTime�ソス�ソス�ソスo�ソス゚ゑソス�ソス�ソスワゑソスtrue�ソスナゑソス�ソス�ソス�ソスヤゑソス�ソスI�ソス�ソス�ソス�ソストゑソス�ソス�ソスtrue�ソスナゑソス�ソス闡ア�ソス�ソス�ソスワゑソス�ソスB

�ソス�ソス�ソスフ托ソス�ソスA�ソス�ソス�ソスO�ソス�ソス�ソス�ソス@�ソス\�ソス�ソス�ソスz�ソス�ソス�ソスナゑソス�ソス�ソス�ソス�ソス�ソスネコ�ソス}�ソス�ソス�ソスh�ソス�名称ゑソス�ソス�ソス�ソスナゑソス�ソスミ介し�ソストゑソス�ソス�ソス�ソスワゑソス�ソスB�ソス�ソス�ソス�ソス�ソストみゑソスニよい�ソスナゑソス�ソス蛯、�ソスB�ソスuExitScript, ExitPIE, Execute(filename), Chain(filename), Display(text), DebugPrint(text), OutputToFile(text), AddCode(text), ControlPanel, ControlPanelKeyboard, ControlPanelJoystick, ControlPanelMouse, ControlPanelP5, ControlPanelPPJoy, ControlPanelSpeech, ControlPanelMidi, ControlPanelDisplay, PlaySound(filename),Beep([freq, duration]), BeepAsterisk, BeepExclamation, BeepHand, BeepQuestion, BeepDefault, FlashPieWindow, HidePie, ShowPie, MinimizePie, MaximizePie, RestorePie, UnMinimizePie, UnMaximizePie, Press(x), Release(x), Toggle(x), Type(text), TypeUnicode(text), SendOsc(ip, port, address, [p1, p2, p3�ソスc]), BroadcastOsc(port, address, [p1, p2, p3�ソスc]), WiimotePoke([wiimote number], address, value), WiimoteSend(wiimote number, report number, [p1, p2, p3�ソスc])�ソスv

WiiRemote�ソスノ抵ソス�ソスレコ�ソス}�ソス�ソス�ソスh�ソス�送ゑソスuWiimoteSend()�ソスv�ソス�ソスA�ソスf�ソス[�ソス^�ソス�ソス�ソスe�ソスL�ソスX�ソスg�ソスt�ソス@�ソスC�ソス�ソス�ソスノ擾ソス�ソス�ソス�ソスo�ソス�ソス�ソスuOutputToFile()�ソスv�ソスネどゑソス�ソス�い�ソス�あ�ソス�ソスワゑソス�ソスB

�ソス�ソス�ソス�ソス�ソスフ関撰ソス(�ソス痰ヲ�ソス�ソスtrunc)�ソスノ具ソス�ソス�ソス�ソス�ソス�ソス�ソス�ソス�ソス�ソス�ソス�ソス�ソスuDebugPrint(trunc(-3.7));�ソスv�ソスニゑソス�ソスト趣ソス�ソスs�ソス�ソス�ソストみてゑソス�ソス�ソス�ソス�ソス�ソス�ソス�ソスB�ソスf�ソスo�ソスb�ソスO�ソスE�ソスC�ソス�ソス�ソスh�ソスE�ソスノ鯉ソス�ソスハゑソス\�ソス�ソス�ソス�ソス�ソス驍ア�ソスニゑソス�ソスナゑソス�ソスワゑソス�ソスB�ソスワゑソス�ソスP�ソスノ「debug = random�ソスv�ソスニゑソス�ソス驍ア�ソスニで「Run�ソスv�ソス{�ソス^�ソス�ソス�ソスフ右�ソス�ソス�ソスノ表�ソス�ソス�ソス�ソス�ソス驍ア�ソスニゑソス�ソスナゑソス�ソスワゑソス�ソスB

�ソス�ソス�ソスノゑソス�ソス}�ソスj�ソス�ソス�ソスA�ソス�ソス�ソスノは算�ソスp�ソスL�ソス�ソス(�ソスI�ソスy�ソス�ソス�ソス[�ソス^�ソス[)�ソスノつゑソス�ソストの会ソス�ソス�ソス�ソス�ソス�ソス�ソス�ソスワゑソス�ソス�ソス�ソスA�ソス�ソス�ソス�ソス�ソスフプ�ソス�ソス�ソスO�ソス�ソス�ソス~�ソス�ソス�ソスO�ソス�ソス�ソス�ソスニ大き�ソス�ソス�ソスマゑソス�ソスネゑソス�ソスフでゑソス�ソス�ソス�ソスナは奇ソス�ソス�ソス�ソス�ソス�ソスワゑソス�ソスB

�ソスネ会ソスWiimote�ソスI�ソスu�ソスW�ソスF�ソスN�ソスg�ソスノつゑソス�ソスト。

Buttons
Up, Down, Left, Right, A, B, Minus, Home, Plus, One, Two�ソスフ擾ソスヤゑソス�ソス謫セ�ソス�ソス�ソスワゑソス�ソスBPower�ソス�ソスSync�ソス{�ソス^�ソス�ソス�ソスヘ托ソス�ソスンゑソス�ソスワゑソス�ソス�ソスB
Motion Sensing

The Wiimote also has three accelerometers which measure forces/accelerations, in each of the three dimensions. Force and Acceleration are basically the same thing, since the mass is constant (F=ma). In GlovePIE they are labelled like this: X is to the right (of the wiimote), Y is up (from the wiimote buttons), and Z is forwards (or wherever the wiimote is pointing). This is the left-handed Direct3D system.

If you drop a Wiimote and it is in freefall, all the forces will be zero. BUT if you are holding a wiimote up so that it doesn�ソスft fall, then you are pushing it upwards with a force equal to the force of gravity, but in the upwards direction. If you hold the Wiimote flat then the force holding it up will be in the +Y direction, but if you point the Wiimote at the ceiling then the force holding it up will be in the +Z direction. This helps us measure the Wiimotes tilt as well as its acceleration.

There are three values that you should never use anymore, because they are obsolete and only for backwards compatability: RawForceX, RawForceY, and RawForceZ. If your script is currently using them, then replace them with the calibrated force values below. Remember the calibrated force values don�ソスft need an offset, and they are about 1/30 the size of the RawForce values.

There are three calibrated force values:

gx, gy, and gz

They can be zero for no force/acceleration, 1 for the same amount of force/acceleration as gravity, or any value in between or outside that range. There is also the vector version:

g

The accelerations above are effectively measured in Gs. You can use them for measuring actual acceleration, or for measuring tilt.

If you prefer acceleration values in other units, you can use these values:

RawAccX, RawAccY, and RawAccZ.

They are measured in Metres Per Second Per Second. But GlovePIE supports units so you can do things like this:

RawAccX in miles per hour per second

to get the value in different units.

The RawAcc values still include gravity.

If you want to get the real acceleration without gravity then you should use the following values instead:

RelAccX, RelAccY, and RelAccZ

They are not very accurate because it is hard for GlovePIE to separate out the force of gravity, but it makes a good attempt.

All these acceleration values are relative to the Wiimote�ソスfs orientation. So Z is wherever the Wiimote is pointing, not necessarily a fixed direction.

Rotations

The Wiimote doesn�ソスft contain gyros (BOO!!!), so it has no way of determining the yaw rotation without using an imitation sensor bar. But it can sort-of tell which way is down, based on the force of gravity. This allows it to measure pitch and roll rotations. You can use the following values:

Pitch, Roll SmoothPitch, SmoothRoll

The angles are all in degrees.

Pitch is the vertical angle. It is 90 when the wiimote is pointing at the ceiling, -90 when it is pointing at the ground, 0 when it is flat, and a value in between for angles in between.

Roll is how much the top is tilted towards the right. It is -180 or +180 when the Wiimote is upside-down, -90 when it is on its left side, +90 when it is on its right side. and 0 when it is flat.

Pitch and Roll attempt to filter out accelerations. This may make them slightly jagged. You can use SmoothPitch and SmoothRoll if you don�ソスft mind getting the wrong result if the wiimote moves, but you do want it to be smooth.

There is also a rotation matrix, for those who prefer it. It is a 3x3 Direct3D style rotation matrix: RotMat

Sensor Bar

The sensor bar is just a bunch of Infra Red lights which are always on. You can make your own fake sensor bar with candles, Christmas tree lights, or Infra-Red remote controls with a button held down. Or you can order a wireless sensor bar off the internet, or you can build your own.

You can read the position of the infra-red dots that the Wiimote can see with: wiimote.dot1x, wiimote.dot1y�ソスcwiimote.dot4x, wiimote.dot4y

You can tell whether an infra-red dot can be seen with Wiimote.dot1vis to Wiimote.dot4vis

You can tell the size of a dot (between 0 and 15) with Wiimote.dot1size to Wiimote.dot4size

The size will always be reported as 16 if your script uses the Nunchuk or Classic Controller, because the report needs to contain more information. LEDs

You can set the 4 LEDs on the Wiimote by setting:

Wiimote.Leds

to a value between 0 and 15. It is binary.

Or you can set:

Wiimote.Led1, Wiimote.Led2, Wiimote.Led3, and Wiimote.Led4

to either true or false individually.

Force Feedback

You can activate force feedback by setting:

Wiimote.Rumble

to either true or false

Speaker

You can play sounds on the Wiimote simply by setting these values:

Frequency, Volume

If you set Frequency to 0 it will switch the speaker off. If you set it to non-zero it will switch the speaker on again. The frequency is measured in Hz. Don�ソスft confuse frequency with pitch, they are different in this context.

You can set the volume to a value between 0 and 2, (between 0% and 200% in other words). I don�ソスft recommend setting it above 100% though, unless you want to go deaf.

You can also turn the speaker on and off by setting either of these values:

Speaker, Mute

Setting speaker to true switches on the speaker (slowly) and setting it to false switches off the speaker. Setting Mute to true mutes the speaker, and setting it to false un-mutes it. Using�ソスhMute�ソスhworks faster than using�ソスgSpeaker�ソスh. Note that you don�ソスft need to turn the speaker on if you set the frequency, because setting the frequency to non-zero does it automatically. Turning sound on and off with mute is also faster than doing it by changing the frequency to 0.

You can also set the sample rate with this variable:

SampleRate

Currently GlovePIE only supports sample rates around 3640 Hz. Sample rates must be multiples of 280 added or subtracted from that value. The default is 3640 Hz. The sample rate is also measured in Hz. The sample rate will automatically increase if you set the frequency higher than 1820 Hz. There isn�ソスft much point in changing the sample rate.

Nunchuck and Classic Controllers

To tell whether a Nunchuk or classic controller is plugged in, use these values:

Wiimote.HasNunChuck Wiimote.HasClassic Wiimote.Expansion

The first two are true or false. The third one is a number: 0 means none, 1 don�ソスft know what kind yet, 2 means Nunchuk, 3 means Classic Controller.

Nunchuk

The Nunchuk has accelerometers too! Most of the same acceleration values and rotation values are the same as the Wiimote, so see the description in the sections above. The difference is the Nunchuk accelerometers have higher precision and lower range.

The Nunchuk also has two buttons. NOTE: Unlike a playstation controller, pushing in the joystick is not a button, don�ソスft try it. The two buttons are:

CButton ZButton

Unlike the other controllers, you need the word�ソスgButton�ソスhon the end, because Z is the name of an axis and I�ソスfm reserving it for future axis use.

The Nunchuk also has a joystick. It uses the following values:

JoyX, JoyY

JoyX is -1 to the left, 0 in the middle, and +1 to the right. JoyY is -1 up, 0 in the middle, and +1 down.

These are the same values used by PPJoy.

The Nunchuk does NOT have vibration, or a speaker.

Classic Controller

The classic controller does NOT have accelerometers or rumble, or a speaker!

The classic controller does have an unexplained lock button in the top centre, which physically opens and closes two slots in the back. The two slots can�ソスft connect to anything and seem totally pointless. The lock button can�ソスft be read.

You can read the following buttons:

a, b, x, y Minus, Home, Plus Up, Down, Left, Right ZL, ZR LFull, and RFull

They are either True or False.

The L button and the R button (LFull, and RFull above) also have analog versions:

L, and R

They will be between 0 and 1. Although mine won�ソスft go below 0.03 when fully released, and yours may not reach 1 when fully pressed.

There are also two joysticks. I�ソスfm calling the one on the left Joy1, and the one on the right Joy2.

Joy1X, Joy1Y, Joy2X, Joy2Y

They are between -1 and 1, the same as the Nunchuk joystick described above. Low level stuff

You can read the data reports from the Wiimote with:

debug = Wiimote.InByteString

Or you can read them individually with:

var.a = Wiimote.InReport var.b = Wiimote.InByte1

You can send data reports to the Wiimote with this function (it has no dot):

WiimoteSend(1, 0x12, 1, 0x33)

The first parameter of WiimoteSend is the Wiimote number you want to send it to, normally 1. The second parameter is the report number. The remaining parameters are the report payload. In this case, the report tells the Wiimote to start vibrating, and to send data via report 0x33.

The one-byte reports can also be sent another way by setting one of these values (it will only send the report when the value changes):

Wiimote.Report11, Wiimote.Report13, Wiimote.Report14, Wiimote.Report15, Wiimote.Report19, Wiimote.Report1A

You can set bytes in the Wiimote�ソスfs onboard memory (where Miis are stored) with the WiimotePoke command, and read bytes from its memory with the WiimotePeek command.

WiimotePoke(1, 0x04B00033, 0x33) var.value = WiimotePeek(1, 0x04B00033)

The first parameter is optional, and it is the Wiimote number. The second parameter is the address. The third parameter is the value you want to set it to (between 0 and 255).

Note that the Nunchuk and Classic Controller have their own memory space which is mapped to the Wiimote�ソスfs when they are plugged in.

Don�ソスft use these low level functions unless you know what you are doing and have read the www.wiili.org/Wiimote page. One person has bricked their nunchuk by experimenting with writing to all its addresses (although that is how we discovered how the nunchuk works).

Multiple Wiimotes

You can tell how many Wiimotes there are with Wiimote.Count

You can access a particular wiimote by putting a number after the word�ソスgwiimote�ソスhand before the dot. For example:

Enter = wiimote2.A

You can tell whether a particular Wiimote exists with Wiimote.Exists

You can�ソスft read the Serial number (as text) anymore with Wiimote.Serial, because I disabled it. It rebooted computers with BlueSoleil when you tried to read the serial.

Don�ソスft forget to sync both Wiimotes with the PC before you try to use them.

WiiRemote�ソス�ソス�ソス|�ソス[�ソス^�ソス�ソス

http://www.wiimoteproject.com/

�ソスヨ係�ソス�ソス�ソス驍ゥ�ソス�ソス�ソス�ソス�ソス�ソスネゑソスWeb/Blog

�ソス�ソス�ソスツて会ソス�ソスy�ソスニ呼ばれた�ソス�ソス�ソス�ソス

http://www.sonasphere.com/blog/�ソス�ソス�ソス苒シ�ソス�ソス(�ソス�ソス)Qosmo�ソス�ソス\�ソス�ソス�ソス�ソス�ソス�ソス^�ソス�ソス�ソス�ソス�ソスY�ソスp�ソス�ソスw�ソス�ソス�ソスホ講�ソスt�ソス^DJ)�ソスH�ソスw�ソス�ソス�ソスm"�ソス�ソス�ソス�ソス�ソスンゑソスiPhone�ソス\�ソスN�ソス�ソス�ソスG�ソスC�ソス^�ソス[�ソスフゑソス�ソス゚ゑソスiPhone SDK�ソスv�ソス�ソス�ソスO�ソス�ソス�ソス~�ソス�ソス�ソスO" (�ソス�ソス�ソス苒シ�ソス�ソス) "iPhone×Music - iPhone�ソス�ソス�ソス\�ソス�ソス�ソス�ソス�ソス�ソスu�ソス�ソス�ソスツゑソス�ソス�ソス�ソスy�ソスニ呼ばゑソス�ソス�ソス�ソスフ」" (�ソス�ソス�ソス苒シ�ソス�ソス,�ソスi�ソス�ソスN�ソスv,�ソス�ソス�ソスq�ソスq�ソス�ソス�ソスY)