setRumble()
Purpose
Start or stop the controller rumble motors
Description
Activate one of the 4 controller motors at the specified frequemcy and volume
Syntax
setRumble( controller, channel, volume, frequency )
Arguments
controller identifier for the controller (0 to 3: 0 is the first)
channel identifier for the motor (0 - top left, 1 - bottom left, 2 - top right, 3 -bottom right)
volume volume (amplitude) of vibration (0 - 1)
frequency frequency of vibration
Example
motors = []
frequency = []
for i = 0 to 4 loop
motors[i] = false
frequency[i] = i * 100 + 100
repeat
volume = 1
loop
clear()
printAt( 0, 0, "Press X to toggle motor 0" )
printAt( 0, 1, "Press Y to toggle motor 1" )
printAt( 0, 2, "Press A to toggle motor 2" )
printAt( 0, 3, "Press B to toggle motor 3" )
for i = 0 to 4 loop
if motors[i] then
setRumble( 0, i, volume, frequency[i] ) // turn on motor
else
setRumble( 0, i, 0, 0 ) // turn off motor
endIf
printAt( 30, i, "motor ", i, ": ", motors[i], " frequency: ", frequency[i] )
repeat
c = controls( 0 )
motor = -1
if c.x then
motor = 0
endIf
if c.y then
motor = 1
endIf
if c.a then
motor = 2
endIf
if c.b then
motor = 3
endIf
if motor > -1 then
motors[motor] = !motors[motor]
sleep( 0.2 )
endIf
update()
repeat
Associated Commands