Welcome! Log In Create A New Profile

Advanced

how do i get the led lights to flash

Posted by BlueWack 
how do i get the led lights to flash
August 07, 2009 06:41AM
I am trying to get the L.E.D lights on the Wii remote to flash, please help asap.
Re: how do i get the led lights to flash
August 07, 2009 07:44AM
Re: how do i get the led lights to flash
August 10, 2009 06:23PM
There is the Wmlflash application which shows how to do this including source: Wiimote LED Flasher

However, it shows that libogc/wpad-functions do not have a straightforward way to write data to the Wiimote.

I put in a feature request for libogc to support that and please support that so libogc allows you flash the LED's in its next release.

SourceForge.net: devkitPro: Feature Requests
Re: how do i get the led lights to flash
August 11, 2009 02:12AM
perfect!

i actually looked thru the link i posted to the wii use site trying to give a clear answer and ran into the same problem the author of the the Wiimote LED Flasher ran into... looks like he found a workaround...

Good find georgp, i'll save this for later usage!
Re: how do i get the led lights to flash
August 11, 2009 08:14AM
The author calls his workaround a "terrible hack". It would be much better if libogc would support it.
Re: how do i get the led lights to flash
August 12, 2009 02:40AM
i'll take the terrible hack until then...
Re: how do i get the led lights to flash
September 15, 2009 04:54PM
I just noticed that they updated wiiuse_set_leds function.
it is void wiiuse_set_leds(struct wiimote_t* wm, int leds,cmd_blk_cb cb); now

Im trying to get my leds to flash.

#include 
#include 
#include 
#include 

static void *xfb = NULL;
static GXRModeObj *rmode = NULL;

//---------------------------------------------------------------------------------
int main(int argc, char **argv) {
//---------------------------------------------------------------------------------

   VIDEO_Init();
   WPAD_Init();
   rmode = VIDEO_GetPreferredMode(NULL);
   xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
   console_init(xfb,20,20,rmode->fbWidth,rmode->xfbHeight,rmode->fbWidth*VI_DISPLAY_PIX_SZ);
   VIDEO_Configure(rmode);
   VIDEO_SetNextFramebuffer(xfb);
   VIDEO_SetBlack(FALSE);
   VIDEO_Flush();
   VIDEO_WaitVSync();
   if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();

   printf("\x1b[2;0H");
   printf("leds\n");
	 while(WPAD_Probe(0, NULL) != WPAD_ERR_NONE)
	 {
		WPAD_ScanPads();
    printf("\n\nfound wiimote\n\n");
    if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) { exit(0); }
	 }

   while(1) {
      WPAD_ScanPads();
      if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) { exit(0); }
      
      if (WPAD_ButtonsDown(0) & WPAD_BUTTON_1)
      {
         wiiuse_set_leds(WPAD_CHAN_0,WIIMOTE_LED_1, NULL);
      }
      if (WPAD_ButtonsDown(0) & WPAD_BUTTON_2)
      {
         wiiuse_set_leds(WPAD_CHAN_0,WIIMOTE_LED_2, NULL);
      }
      if (WPAD_ButtonsDown(0) & WPAD_BUTTON_A)
      {
         wiiuse_set_leds(WPAD_CHAN_0,WIIMOTE_LED_3, NULL);
      }
      if (WPAD_ButtonsDown(0) & WPAD_BUTTON_B)
      {
         wiiuse_set_leds(WPAD_CHAN_0,WIIMOTE_LED_4, NULL);
      }

      // Wait for the next frame
      VIDEO_WaitVSync();
   }
   return 0;
}

only problem with this code is that the leds wont flash when I press buttons on wiimote.
Sorry, only registered users may post in this forum.

Click here to login