WiiLAB Example Code - setWiimoteRumble
Note: MATLAB R2007a or greater is required for this code to run correctly.
Annotations
The setWiimoteRumble function allows the user to control the rumble/vibrate property of the Wiimote.
Usage
setWiimoteRumble([on]);
* where [on] is either a boolean value (true/false) or an integer (1/0)
- true or 1 will turn the Wiimote's rumble on
- false or 0 will turn the Wiimote's rumble off
Example
The following snippet of code will execute the block inside the if statement and display 'Wiimote rumble is on'.
if ( setWiimoteRumble(true) )
disp('Wiimote rumble is on');
end
Raw Source Code
The source code is also available as a .m file download at the bottom of the page.
function setWiimoteRumble (on)
% usage: setWiimoteRumble (on)
% purpose: Sets the rumble on the wiimote
% on is a bool(or 1/0 int) true to turn on rumble, false to turn
% it off
% note: initializeWiimote() must be called before calling this function
global wiimote;
% Set the rumble
wiimote.SetRumble(on);
end