SImple Question
March 07, 2009 10:22PM
What is the function for the nunchuk joystick? i can't find it
Re: SImple Question
March 07, 2009 10:30PM
Its not a function. Its a struct made up of other structs.
Re: SImple Question
March 07, 2009 10:46PM
What is the struct then?
Re: SImple Question
March 07, 2009 10:51PM
A struct is the C version of a C++ class. On the outside, they're basically the same thing.

Nvm, I thought you asked what is a struct (I read too fast lol). Hold on, I'll post my WiiBreaker code for you in a second.

Alright, here is the exact code I used in WiiBreaker to get nunchuk input:

expansion_t exp;
exp.type = WPAD_EXP_NUNCHUK;

In my main loop:


WPAD_Expansion(WPAD_CHAN_0, &exp);

if(exp.nunchuk.js.ang>=270-45 && exp.nunchuk.js.ang<=270+45) && exp.nunchuk.js.mag>=0.9)

if(exp.nunchuk.js.ang>=90-45 && exp.nunchuk.js.ang<=90+45) && exp.nunchuk.js.mag>=0.9)

Hope that helps :)

Edited 4 time(s). Last edit at 03/07/2009 10:59PM by Arikado.
Re: SImple Question
March 07, 2009 11:18PM
OK i put the code into my main function, but it isn't working, i could be making a stupid mistake, but i put the 2nd part in my main function and i did the same with the first one. When i compile there are no errors but nothing happens when i go left and right on the joystick. I know that my nunchuk is working because it can detect when i push Z.
I also replaced the moveleft and moveright functions with printf
Re: SImple Question
March 07, 2009 11:52PM
Make sure you call WPAD Expansion as well as WPAD ScanPads each time through your main loop.
Re: SImple Question
March 08, 2009 10:53AM
Personally, I recommend thinking about your choice for the joystick dataformat. Not only can you get an angle, you can also get the real read x and y values. Use whatever that makes your math easy.
Sorry, only registered users may post in this forum.

Click here to login