Wiimote and Glovepie

by raykholo in Circuits > Raspberry Pi

71699 Views, 16 Favorites, 0 Comments

Wiimote and Glovepie

GlovePIE-Window.jpg
Glovepie is a program by Carl Kenner that allows you to write codes that link the Wiimote into your PC
A special thanks to Carl Kenner, who wrote Glovepie

First, follow my other instructable to sync your wiimote to your PC
Download and Install Glovepie on your PC - I am using version .30

Now, basically this instructable is about how to use the programming language that glovepie uses as input (for beginners to software programming and such)
if you know how to write software, a quick look at this Glovepie Wiki is all you might need

--before i started using this app, i had virtually no experience or knowledge of programming. the best way to learn is to look at already written scripts, and you can pick up on how to write them - thats what i did

pics won't exactly help here, so just follow the directions, and if you need more help, just send a comment and i will be happy to help asap

General Basics and Structure

Think of a basic code as a cause/effect sentence - basically meaning -- something(cause) triggers something else (effect), followed by a period.

In code language, that would look like:
if - followed by cause
- - - - - effect (can be many)
endif - equivalent of period

Example -- if i wanted the first light on the wiimote to go on when i pressed A --
if wiimote.a
wiimote.led1 = true
endif

other ways to write this are:
if wiimote.a then wiimote.led1 = true
or
wiimote.a = wiimote.led = true

you might notice that even if you let go of A, the led stays on, because its value was set to true.

if you want it to only go on while pressing the button, use the else command like this -- incorporated into the first code --

if wiimote.a
wiimote.led1 = true
else
wiimote.led1 = false
endif

that would be a double cause/effect and the light would work that way because a "counter" is provided for when you let go of the button

Anything on the wiimote is addressed in glovepie as wiimote._
the key list for use is as follows: (the power button is not and can't be used here)
Wiimote. :
DPAD :
UP
DOWN
LEFT
RIGHT
A
B
MINUS
HOME
PLUS
ONE
TWO

Refer to the wiki for info on the lights and other stuff you can do

Stuff That's Called Big Words

The Wiki I linked onto the first page has links on the top to glovepie, scripting, how to write scripts, and already written scripts that you can copy right into the app. i am taking all that stuff and making it a lot easier to understand

SO,
Boolean operators basically are used in the cause/effect statment aka if/else statments that i just talked about
the boolean is the true/false part of it

Vars are variables that represent something else
they are written as:
var. --- = ----

Debug is the little text box to the right of the run/stop button when the app is running.
on default in my version, it is left blank
we can change that
just write :
debug = you can write commands and vars, any text goes in quotes, with pluses in between commands and other spaces. for example:
debug = var.1 + var.2 + "wiimotes"
simple as that.

And More Advanced Stuff

this is stuff right out of the wiki and documentation
Wiimote Leds:
the lights on the wiimote can be addresed individually aswiimote.led_ = true/false
the wiki also shows light combinations 0 - 15, which are adressed as wiimote.leds = number

Wimote Battery:
Thw wiimote can return reports on battery life

wiimote can recognize attatched accesories by wiimote.hasnunchuk or other stuff.

There is a lot more for the experts:
you can program it to be used as a mouse
It can detect: roll, pitch, yaw, acceleration.. and a lot more

My Offer and Request


Now.. What does all this mean? I have no idea with half of it. Like I said, i have almost no experience with writing scripts and software..

If there is anyone who knows how to do all this stuff that i cant, I would be happy to collaborate and help to make this instructable the best it can be.
If you want to be part of this, please:
look over the wikis and documentation
then, get in touch with me, and i will be happy to let you in

THANKS TO ALL
RAK