Pages: [1]   Go Down
Author Topic: Wiimote Extension Library Problem  (Read 447 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

First of all, my code:
Code:
#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:
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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm pretty new too...

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



K
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 654
Posts: 50928
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Faraday Member
**
Karma: 62
Posts: 3080
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: