Go Down

Topic: Wiimote Extension Library Problem (Read 522 times) previous topic - next topic

gudenau

First of all, my code:
Code: [Select]
#include <wiimote.h>

int nl = 0;

byte whammy = 0;
boolean whammyUp = true;

unsigned char data[6];

unsigned char id[6] = {0x00, 0x00, 0xA4, 0x20, 0x01, 0x03};

unsigned char cal[32]={
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00
};

void timer(){
}

void setup(){
Serial.begin(9600);
Serial.println("Hello world!");

data[0] = 0b00000000;
data[1] = 0b00000000;
data[2] = 0b00000000;
data[3] = 0b00000000;
data[4] = 0b00000000;
data[5] = 0b00000000;

wm_init(id, data, cal, timer);
}

void updateWhammy(){
if(whammyUp){
whammy++;

if(whammy >= 31){
whammyUp = false;
}
}else{
whammy--;

if(whammy <= 0){
whammyUp = true;
}
}
}

void loop(){
if(Serial.available() > 0){

}

updateWhammy();
}


Second I put the wiimote.c, wiimote.h and wm_crypto.h; from here, in Arduino\libraries\wimmote.

Third this is the error at compile:
Code: [Select]
AutoGiutar.cpp.o: In function `setup':
C:\Users\(censor)\Desktop\arduino-1.0.4/AutoGiutar.ino:38: undefined reference to `wm_init(unsigned char*, unsigned char*, unsigned char*, void (*)())'


So, the function does not seem to want to be passed as an argument, I am new to this part and I have spent a while on Google looking for the solution.

I'm pretty new too...

Look at AutoGiutar.cpp. Look for the setup function and see what it wants.



K

PaulS

Well, where is wm_init() defined? I see where it is called, but I don't see it defined.

michinyon

I don't understand what you mean when you say,  it doesn't like the function being passed as an argument.

I can see where you try to call the function.    I don't see anywhere that you try to pass it as an argument.

gudenau

Have you looked in the sources for the files I have included? The timer function needs to be an argument for the wm_init. I want to say it gets called when the wiimote gets new data.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy