Asked — Edited

Assigning Scripts To Wii Mote Buttons

any one have any practice adding up and down scripts to wii mote buttons?

I so far have only been able to add one function.

I am unsure if there is a command in the scripts or if I can add my script to key controls.

Any advice would be appreciated.

What I am trying to do is to make buttons 1 and 2 on the wii mote make my arms go up and when I release the buttons I want them to go down.

I.E. set D18 on , d19 off and on release d19 on and d18 off

Thanks,

Mike


ARC Pro

Upgrade to ARC Pro

Unleash your robot's full potential with the cutting-edge features and intuitive programming offered by Synthiam ARC Pro.

United Kingdom
#1  

On the config page for the wiimote click on buttons You have a bunch of buttons for script commands Button A, Button B, etc. all the way down to Button Z.

In each of these boxes you can either type a single command (i.e. to start a script use ControlCommand("Script", ScriptStart) modified to suit the name of the script)

Or, to the right of the boxes is a small icon which looks like a pencil, click on it for the full EZ-Script dialogue for multiline commands.

Add your scripts or controlcommands to the buttons, click save then test it out.

#2  

Rich,

Thanks as always for your quick response.

I don't think I was clear in my post so let me fill you in on what I was really asking:)

I wanted to know how to assign actions to the up and down actions to the Wii mote buttons.

So what I previously had was a key on the key board that if I pushed it down the arms when up.

When I released the key the arms came down.

But it seams that the Wii mote can only report down key presses.

So what I did was assign the up motion to the 1 button and the down motion to the 2 button.

Then I assigned a kill function to the B or the Trigger that stops all arm movements.

I am trying to accomplish a hand shaking motion but as of right now if I go between the 1 and 2 button this will work.

Do you have any other suggestions ?

Thanks as always Rich and have a good week.

Michael

United Kingdom
#3  

Ah I see. I'm not too familiar with the Wiimote control since I've never used it and don't have ARC in front of me but...

If the "Button Up" function isn't there then you will need to do things a little differently. Basically, when you press the button on the wiimote it starts the script in the wiimote control. This is fine for moving the arm up since you could either loop a script to move the servo up in increments;

ServoUp(D0,1)

or move to a position

Servo(D0,100)

On pressing the button the servo will move in whichever method. If the ServoUp() command is used then it will continue to move up by 1 (or whatever increment you set) while the button is held (I assume, I have no way of checking this). But on release I presume you want it to move back to the neutral position?

What you could do is have a script running constantly which resets a flag or variable;

:loop
$wiimotebuttona = "up"
sleep(100)
Goto(loop)

You could have a simple script on the button to change the flag or variable

$wiimotebuttona = "down"

And you could have another script which moves the arm depending on the flag/variable.

:loop
IF($wiimotebuttona = "down")
  Servo(D0, 100)
Else
  Servo(D0, 0)
EndIf
sleep(50)
Goto(loop)

In theory, this should detect the change on the wiimote button and move the arm to position. On release the other script resets the variable and the movement script knows the button has been released.

Like I said, this is without ARC or a wiimote in front of me so may need some adjustment (or may not work at all). I may have even over complicated it or it may just be a case of the "Button Up" commands need adding to the control which may be simple enough for DJ to implement in his usual lightning speed:)