|
Forum Index : Microcontroller and PC projects : CMM2 Check for Nunchuk Controller
| Author | Message | ||||
| Archimedes5000 Newbie Joined: 21/01/2021 Location: GermanyPosts: 6 |
Hello, CMM2 V5.06 - is it possible to check the presence of a nunchuck controller without the program ending with an error? Greetings Axel |
||||
| Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 9131 |
I've not used a nunchuck, but I'd attempt it by setting up a ON ERROR SKIP [nn] before a nunchuck command to read something, then check to see if the returned value is zero. If it is then there's no nunchuck. Mick Zilog Inside! nascom.info for Nascom & Gemini |
||||
| Archimedes5000 Newbie Joined: 21/01/2021 Location: GermanyPosts: 6 |
Hi, thank you! By searching for "On Error skip" I found this https://www.thebackshed.com/Forum/ViewTopic_mobile.php?TID=13475&P=1 Will try and be back later. Greetings Axel |
||||
| twofingers Guru Joined: 02/06/2014 Location: GermanyPosts: 1769 |
Please take a look at this example: 'Mandelbrot Explorer V1.3 for Color Maximite 2 9/20/2020 'By the Sasquatch '[...] 'Check for Wii Nunchuk On Error Skip 1 Wii Nunchuk Open If MM.ERRNO = 0 Then If Nunchuk(T) = &HA4200000 Then 'Check for original style nunchuk HaveChuk = True Else Wii Nunchuk Close End If End If If Not HaveChuk Then 'Check for Wii Classic Controller On Error Skip 1 Wii Classic Open If MM.ERRNO = 0 Then If Classic(T) = &HA4200101 Then 'Check for Classic HaveClassic = True Else Wii Classic Close End If End If End If I used this for a short test: TRUE=1 FALSE=Not TRUE On Error Skip 1 Wii Nunchuk Open If MM.ERRNO = 0 Then HaveChuk = True ? HaveChuk PRINT HEX$(NUNCHUK(T, 3)) do PRINT "X-Joystick:"NUNCHUK(JX, 3) PRINT "Y-Joystick:"NUNCHUK(JY, 3) PRINT "Z-BUTTON :"NUNCHUK(Z, 3) PRINT "C-BUTTON :"NUNCHUK(C, 3) PRINT "X"NUNCHUK(AX, 3)-512 PRINT "Y"NUNCHUK(AY, 3)-512 PRINT "Z"NUNCHUK(AZ, 3)-512 PRINT NUNCHUK(AX0, 3)-512 PRINT NUNCHUK(AX1, 3)-684 PRINT NUNCHUK(AY0, 3)-512 PRINT NUNCHUK(AY1, 3)-684 PRINT NUNCHUK(AZ0, 3)-512 PRINT NUNCHUK(AZ1, 3)-684 pause 1000 loop Michael ‚My name is Ozymandias, king of kings Look on my works, ye Mighty, and despair!‘ Nothing beside remains. Round the decay Of that colossal wreck, boundless and bare The lone and ... |
||||
| Archimedes5000 Newbie Joined: 21/01/2021 Location: GermanyPosts: 6 |
Please take a look at this great product. It has 3 nunchuk ports. https://www.thebackshed.com/forum/ViewTopic.php?FID=16&TID=13673 So I have to find out whether and to which port a nunchuk is connected. I will be back... Greetings Axel |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2026 |