Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 11:14 01 Aug 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Different Wii controllers

Author Message
capsikin
Guru

Joined: 30/06/2020
Location: Australia
Posts: 341
Posted: 03:32am 30 Jul 2020
Copy link to clipboard 
Print this post

From the CMM2: V5.05.04RC1 thread:

  mkopack73 said  Ok not sure if this is a bug or not -

If I have the nunchuk plugged in and do a Wii classic open it works (and Vice versa).

I assume this is ok since it’s the same i2C protocol and data flowing. I assume we need to query the T option to determine which was actually plugged in? I assume you also didn’t do the check internally to keep the 2 from failing if the opposite command was used because of the desire to use these commands for talking to other i2C devices?



Also, I’m confused on the: on error skip N
I put that before the open classic call to try to skip the 2 lines after it (a print and then the close) but it always seems to execute the print. I’m not sure what I’m doing wrong.

Any chance in the future of getting an ON Error goto label. ??? (Thinking rudimentary equivalent to C++/java try/catch handling )


Is this still the case in the release version? If so, it would be good to mention in the manual.

Something like:
"The firmware checks for the existence of the Nunchuk on open and will throw error if not found." [continue] "If a classic controller is plugged in instead, an error will not be thrown, instead you can check the ID code with NUNCHUK(T, channel)"
(and similarly for the classic controller if a nunchuk is plugged in instead)

Code examples
Autodetection between the two would be a good code example, for anyone who's making code examples (and maybe has both controllers).

NES classic/SNES classic controllers
The controllers for the NES Classic Edition and Super NES Classic Edition also use i2c and the same physical interface.

http://wiibrew.org/wiki/Wiimote/Extension_Controllers#List_of_extension_controllers

suggests that the SNES classic/mini controller at least, may be similar to the classic controller, but with a different ID code same as the classic controller pro.

It would be interesting to see if you can use the classic controller code with these.
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 05:06am 30 Jul 2020
Copy link to clipboard 
Print this post

I think he classic and nunchuk use the same initialization code.
MMBasic has to remember which controller you opened as because there are different values available.

It is simple to test for yourself.
This is with a Classic controller connected to the front port:
WII CLASSIC OPEN
'
PRINT "opened"
PRINT HEX$(CLASSIC(T, 3))
WII CLASSIC CLOSE

PRINT "closed"

WII NUNCHUK OPEN
'
PRINT "opened"
PRINT HEX$(CLASSIC(T, 3))
WII NUNCHUK CLOSE


opened
A4200101
closed
opened
[12] Error: Not open


So, yes you do have to check to see if you have plugged in what is expected.
If you change the second part of the above code
WII NUNCHUK OPEN
'
PRINT "opened"
PRINT HEX$(nunchuk(T, 3))
WII NUNCHUK CLOSE

The HEX$(nunchuk(T, 3)) will return the Classic ID without any errors so you can easily program against users doing the wrong thing.

Open as Nunchuk and test for Nunchuk ID. If not, either close and reopen as Classic or simply tell the user to "get it fixed".

If the SNES classic/mini controller replies with the same data as the Classic does, the ID code shouldn't matter.

I have created a PS/2 mouse to Classic converter and used the Classic ID so software doesn't get upset.
I made sure (or at least tried to) that what I send is valid for the Classic.

Jim
VK7JH
MMedit
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025