Show Posts
Pages: [1]
1  Forum 2005-2010 (read only) / Development / Re: function overloading on: January 19, 2009, 07:05:28 pm
Yes, and it works. It was a problem with the datatypes, though the messages weren't really explanative.

Now I'm getting the following error for each member function referencing nunchuck_buf:

hardware\libraries\Nunchuck\NunChuck.o: In function `NunChuck::zbutton()':
..\arduino-0012/hardware\libraries\Nunchuck/NunChuck.cpp:154: undefined reference to `NunChuck::nunchuck_buf'

zbutton() is defined as following:

int NunChuck::zbutton()
 ¬† ¬†return ((nunchuck_buf[5] >> 0) & 1) ? 0 : 1;

and the header file:
#include <inttypes.h>
#include <WProgram.h>

class NunChuck
            static uint8_t nunchuck_buf[6];
            static void init();
            NunChuck(uint8_t, uint8_t);
            void send_request();
            uint8_t decode_byte (uint8_t);
            int get_data();
            void print_data();
            int zbutton();
            int cbutton();
            int joyx();
            int joyy();
            int accelx();
            int accely();
            int accelz();
2  Forum 2005-2010 (read only) / Development / function overloading on: January 19, 2009, 04:59:40 pm
Hi all,

I'm trying to create a Wii Nunchuck library for the arduino based on Tod E. Kurt's nunchuck_funcs.h code.

Does the arduino environment support function/constructor overloading???

The library I made is overloading the class constructor either without any parameters or specifying the two pins that will provide power and GND for the mote.
Pages: [1]