Sparkfun provided the .cpp and .h files for this module but they don't work. I have changed WProgram.h to Arduino.h in both the .cpp & .h files. Are there other changees that need to be made???
I have included the .cpp & .h files and the error messages that each produced. Notice that the .cpp file can't locate the .h file. They are in the same directory. IS THERE A PREFERRED location for files???
Thanks for your help.
/* Arduino ADNS2620 Library
- Copyright 2010 SparkFun Electronic
- Written by Ryan Owens
*/
#ifndef adns2620_h
#define adns2620_h
#include <avr/pgmspace.h>
#include "Arduino.h"
class ADNS2620
{
public:
ADNS2620(int sda, int scl);
void begin();
void sync();
char read(char address);
void write(char address, char value);
private:
int _sda;
int _scl;
};
/* Register Map for the ADNS2620 Optical Mouse Sensor */
#define CONFIGURATION_REG 0x40
#define STATUS_REG 0x41
#define DELTA_Y_REG 0x42
#define DELTA_X_REG 0x43
#define SQUAL_REG 0x44
#define MAXIMUM_PIXEL_REG 0x45
#define MINIMUM_PIXEL_REG 0x46
#define PIXEL_SUM_REG 0x47
#define PIXEL_DATA_REG 0x48
#define SHUTTER_UPPER_REG 0x49
#define SHUTTER_LOWER_REG 0x4A
#define FRAME_PERIOD 0x4B
#endif
Arduino: 1.6.5 (Windows 7), Board: "Arduino Uno"
Build options changed, rebuilding all
-
-
-
- Error messages below * * * *
C:\Users\user\AppData\Local\Temp\build3398894251827389011.tmp/core.a(main.cpp.o): In functionmain': C:\Users\user\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.2\cores\arduino/main.cpp:40: undefined reference to
setup'
C:\Users\user\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.2\cores\arduino/main.cpp:43: undefined reference to `loop'
collect2.exe: error: ld returned 1 exit status
Error compiling.
- Error messages below * * * *
-
-
/* Arduino ADNS2620 Library
- Copyright 2010 SparkFun Electronic
- Written by Ryan Owens
*/
#ifndef adns2620_h
#define adns2620_h
#include <avr/pgmspace.h>
#include "Arduino.h"
class ADNS2620
{
public:
ADNS2620(int sda, int scl);
void begin();
void sync();
char read(char address);
void write(char address, char value);
private:
int _sda;
int _scl;
};
/* Register Map for the ADNS2620 Optical Mouse Sensor */
#define CONFIGURATION_REG 0x40
#define STATUS_REG 0x41
#define DELTA_Y_REG 0x42
#define DELTA_X_REG 0x43
#define SQUAL_REG 0x44
#define MAXIMUM_PIXEL_REG 0x45
#define MINIMUM_PIXEL_REG 0x46
#define PIXEL_SUM_REG 0x47
#define PIXEL_DATA_REG 0x48
#define SHUTTER_UPPER_REG 0x49
#define SHUTTER_LOWER_REG 0x4A
#define FRAME_PERIOD 0x4B
#endif
Arduino: 1.6.5 (Windows 7), Board: "Arduino Uno"
Using library ADNS2620 in folder: C:\Program Files (x86)\Arduino\libraries\ADNS2620 (legacy)
]ADNS2610.cpp.ino.ino:8:22: fatal error: adns2610.h: No such file or directory
compilation terminated.
Error compiling.