Page 1 of 2 12 LastLast
Results 1 to 10 of 16
  1. #1
    Wii U Section Moderator
    Computer Engineer
    MrOwnership's Avatar

    Badge

    Join Date
    Jun 2011
    Location
    Maryland
    Posts
    1,435
    Points
    2,862
         User Info     Contact     Gamer ID
    Join Date
    Jun 2011
    Location
    Maryland
    Posts
    1,435
    Points
    2,862
    Gamer IDs

    Steam ID: MrOwnership Wii Code: MrOwnership

    Default Nunchuk Controlled LED's

    This is just a simple program I wrote earlier today to control some LED's based on the degree of rotation of a Nintendo Nunchuk. The Z and C buttons will change the plane of use, the Z button changes it to the x plane and the C button changes it to the y plane, all shown in the video. Essentially the script is mapping the 360 degree rotation to the 13 output pins and setting each pin high when necessary.



    Code:
    #include "Wire.h"
    #include "WiiChuck.h"
    
    WiiChuck nunchuk = WiiChuck();
    int LEDMap = 0;
    int plane = 0; // 0=x; 1=y
    
    void setup() 
    {
      for (int i = 0; i < 14; i++) 
        pinMode(i, OUTPUT);
      nunchuk.begin();
    }
    
    void loop() 
    {
      nunchuk.update();
      if (nunchuk.zPressed () != 0)
        plane = 0;
      if (nunchuk.cPressed () != 0)
        plane = 1;
      
      if (plane == 0)
        LEDMap = map((int) nunchuk.readAccelX(), -180, 180, 0,13);
      else
        LEDMap = map((int) nunchuk.readAccelY(), -180, 180, 0,13);
        
      digitalWrite(LEDMap, HIGH); 
      delay(1);
      digitalWrite(LEDMap, LOW);
    }





    6 Not allowed! Not allowed!

  2. #2
    I agree. MatthewH's Avatar
    Join Date
    Jul 2011
    Location
    North Carolina
    Posts
    3,481
    Points
    15,810
         User Info     Contact     Gamer ID
    Join Date
    Jul 2011
    Location
    North Carolina
    Posts
    3,481
    Points
    15,810

    Default

    Extremely cool!
    What are you using to do all this?

    0 Not allowed! Not allowed!


  3. #3
    Banned

    Badge

    Join Date
    Oct 2013
    Location
    Being Grumpy
    Posts
    1,301
    Points
    285
         User Info     Contact     Gamer ID
    Join Date
    Oct 2013
    Location
    Being Grumpy
    Posts
    1,301
    Points
    285
    Gamer IDs

    Gamertag: CandyCrusher PSN ID: CandyCrusher

    Contact info:

    Youtube Channel: http://www.youtube.com/

    Default

    Quote Originally Posted by ColdfireTube View Post
    Extremely cool!
    What are you using to do all this?
    If you notice on the right side, there is a usb cable, it is going into a pc. That's why he provided c++ code.

    -2 Not allowed! Not allowed!

  4. #4
    Moderator chewtoys's Avatar
    Join Date
    Jun 2013
    Posts
    2,332
    Points
    3,374
         User Info     Contact     Gamer ID
    Join Date
    Jun 2013
    Posts
    2,332
    Points
    3,374

    Default

    Quote Originally Posted by ColdfireTube View Post
    Extremely cool!
    What are you using to do all this?
    According to his pictures, an Arduino.

    0 Not allowed! Not allowed!

  5. #5
    Nintendo Section Moderator PvtRyan's Avatar

    Badge

    Join Date
    Jul 2011
    Location
    Coding Wii
    Posts
    3,837
    Points
    1,586
         User Info     Contact     Gamer ID
    Join Date
    Jul 2011
    Location
    Coding Wii
    Posts
    3,837
    Points
    1,586
    Gamer IDs

    PSN ID: gamer_pvtryan Steam ID: pvtryan_cl Wii Code: PvtRyan

    Contact info:

    Youtube Channel: http://www.youtube.com/xPvtRyanx

    Default

    Nice work! I like, I am going to get a wire kit soon so I can fire up my arduino, I have LEDs and a bread board, just need to get some nice wires, if you want I have a project idea that I was going to work on if you want to help.

    0 Not allowed! Not allowed!


    PS4 Profile:

  6. #6
    Gymshark Outlaw's Avatar
    Join Date
    Oct 2011
    Location
    somewhere in the abyss
    Posts
    4,981
    Points
    5,116
         User Info     Contact     Gamer ID
    Join Date
    Oct 2011
    Location
    somewhere in the abyss
    Posts
    4,981
    Points
    5,116
    Gamer IDs

    PSN ID: TheAdmiral303

    Contact info:

    Youtube Channel: http://www.youtube.com/channel/UCREc2hm6GvtwKn3l0eJ2dwA

    Default

    I'm assuming this is how the Wii sensor bar works? But very cool and interesting stuff.

    0 Not allowed! Not allowed!
    Go to http://bit.ly/1C01ZFM for custom modded controllers for Xbox One, PS4, Xbox 360 and PS3! Use the promo code: THEADMIRAL303 for your discount!

    Get a pair of the best gaming glasses: http://bit.ly/1AKk3El

    Bitcoin:
    16SeT5wqZRHoxPyEwD8HqjCa3xq5858RD4


  7. #7
    Wii U Section Moderator
    Computer Engineer
    MrOwnership's Avatar

    Badge

    Join Date
    Jun 2011
    Location
    Maryland
    Posts
    1,435
    Points
    2,862
         User Info     Contact     Gamer ID
    Join Date
    Jun 2011
    Location
    Maryland
    Posts
    1,435
    Points
    2,862
    Gamer IDs

    Steam ID: MrOwnership Wii Code: MrOwnership

    Default

    Quote Originally Posted by PvtRyan View Post
    Nice work! I like, I am going to get a wire kit soon so I can fire up my arduino, I have LEDs and a bread board, just need to get some nice wires, if you want I have a project idea that I was going to work on if you want to help.
    Sure, just let me know.

    Quote Originally Posted by TheAdmiral View Post
    I'm assuming this is how the Wii sensor bar works? But very cool and interesting stuff.
    There is nothing special about the sensor bar, all it is is some IR LED's, you could make your own if you were to break one.

    0 Not allowed! Not allowed!

  8. #8
    Nintendo Section Moderator PvtRyan's Avatar

    Badge

    Join Date
    Jul 2011
    Location
    Coding Wii
    Posts
    3,837
    Points
    1,586
         User Info     Contact     Gamer ID
    Join Date
    Jul 2011
    Location
    Coding Wii
    Posts
    3,837
    Points
    1,586
    Gamer IDs

    PSN ID: gamer_pvtryan Steam ID: pvtryan_cl Wii Code: PvtRyan

    Contact info:

    Youtube Channel: http://www.youtube.com/xPvtRyanx

    Default

    Quote Originally Posted by MrOwnership View Post
    There is nothing special about the sensor bar, all it is is some IR LED's, you could make your own if you were to break one.
    Yeah, there are 2 LEDs the emitter and receiver. The wii mote has an emitter and the wii bar is the receiver, the nunchuck as shown in the diagram has a motion transmitter that is sent to the wiimote and then emits to the receiver. I learned this when I first bought my LEDs from RadioShack.


    <PvtRyan used Tapatalk to make this Post>

    0 Not allowed! Not allowed!


    PS4 Profile:

  9. #9
    Wii Coder
    ChumLee's Avatar

    Badge

    Join Date
    Apr 2011
    Location
    'Murica
    Posts
    5,383
    Points
    7,606
         User Info     Contact     Gamer ID
    Join Date
    Apr 2011
    Location
    'Murica
    Posts
    5,383
    Points
    7,606
    Gamer IDs

    Gamertag: TERR0Rx9

    Contact info:

    Youtube Channel: http://www.youtube.com/user/HAXZingTERR0R

    Default

    Pretty cool dude. I've been meaning to get an arduino for a while now, but I just don't feel like spending the money. lol

    0 Not allowed! Not allowed!


  10. #10
    Banned

    Badge

    Join Date
    Oct 2013
    Location
    Being Grumpy
    Posts
    1,301
    Points
    285
         User Info     Contact     Gamer ID
    Join Date
    Oct 2013
    Location
    Being Grumpy
    Posts
    1,301
    Points
    285
    Gamer IDs

    Gamertag: CandyCrusher PSN ID: CandyCrusher

    Contact info:

    Youtube Channel: http://www.youtube.com/

    Default

    Quote Originally Posted by ChumLee View Post
    Pretty cool dude. I've been meaning to get an arduino for a while now, but I just don't feel like spending the money. lol
    How much are they and where can you buy them from?

    -1 Not allowed! Not allowed!

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -10. The time now is 11:26 AM.
Powered by vBulletin®
Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.