Note that there are some explanatory texts on larger screens.

plurals
  1. POProblems using the wiiuse library and its events
    primarykey
    data
    text
    <p>I recently downloaded the wiiuse library and am having problems using it. I wrote a small code but the remote disconnects just after the connection. Even the code present at the <a href="http://wiiuse.net/?nav=example" rel="noreferrer">author's website</a> doesn't work; the same happens when I try that code. I tried the demo application I got with the library but that works fine. </p> <p>I'm using Windows XP SP3 and MinGW ( gcc 4.5.0 ) for compiling the codes.</p> <hr> <h3>EDIT 1</h3> <p>I've tried the same with Linux. There, it doesn't suffer with the disconnection problem but it has problems picking up the correct EVENTS. Whatever I do, it only emits/catches <code>WIIUSE_NONE</code>. The <code>WIIUSE_EVENT</code> is never emitted/caught.</p> <p>Here's my code:</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include "wiiuse.h" #define NUMBER_OF_REMOTES 1 void handle_event(struct wiimote_t* rm){ if(IS_PRESSED(rm, WIIMOTE_BUTTON_UP)){ printf("\n - IR Activated - \n"); wiiuse_set_ir(rm,1); } else if(IS_PRESSED(rm, WIIMOTE_BUTTON_DOWN)){ printf("\n - IR Dectivated - \n"); wiiuse_set_ir(rm,0); } if(WIIUSE_USING_IR(rm)){ for(int i=0; i&lt;4; i++){ if(rm-&gt;ir.dot[i].visible){ printf("IR source %i: (%u, %u)\n", i, rm-&gt;ir.dot[i].x, rm-&gt;ir.dot[i].y); } printf("IR cursor: (%u, %u)\n", rm-&gt;ir.x, rm-&gt;ir.y); printf("IR z distance: %f\n", rm-&gt;ir.z); } } } void handle_disconnect(struct wiimote_t* rm){ printf("\n - DISCONNECTED - ID: %i\n\n", rm-&gt;unid); } int main() { wiimote** remote = wiiuse_init(NUMBER_OF_REMOTES); printf("Searching..."); int found = wiiuse_find(remote, NUMBER_OF_REMOTES, 5000); printf("Found %d devices\n", found); int connected = wiiuse_connect(remote, found); if(!connected){ printf("Failed to connect\n"); return 0; } else{ printf("Connected\n"); wiiuse_rumble(remote[0],1); Sleep(250); wiiuse_rumble(remote[0],0); while(1){ if (wiiuse_poll(remote, NUMBER_OF_REMOTES)) { for(int i=0;i&lt;NUMBER_OF_REMOTES; i++){ switch(remote[i]-&gt;event){ case WIIUSE_EVENT: handle_event(remote[i]); break; case WIIUSE_DISCONNECT: case WIIUSE_UNEXPECTED_DISCONNECT: handle_disconnect(remote[i]); break; default: break; } } } } wiiuse_cleanup(remote,NUMBER_OF_REMOTES); } } </code></pre> <p>Can't anyone do anything? I really need to fix the problem as early as possible.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload