Alright guys, I’m at my wits end. I think this may be impossible. I am trying to use SoftwareSerial in my own library (DX160.h, DX160.cpp). I’ve come to the realization that this is impossible. Below, I’ve shorted the library files and the .pde file. First, the .h file, second the .cpp file, and third the .h file.
When I go to compile this, the following message appears:
DX160.cpp: In member function ‘void DX160::init(int)’:
DX160.cpp:13: error: insufficient contextual information to determine type
o: In function setup': undefined reference to
DX160::init(int)’
my .pde file
#include <SoftwareSerial.h>
#include "DX160.h"
DX160 example;
void setup()
{
example.init(57600);
}
void loop()
{
//example.helloWorld();
delay(3000);
}
DX160.cpp
#include "DX160.h"
#include "avr/interrupt.h"
#include <inttypes.h>
#include "SoftwareSerial.h"
//#include "WProgram.h"
void DX160::init(int baud)
{
Com.begin(57600);
}
void DX160::helloWorld()
{
for(int i=0;i<5;i++)
{
digitalWrite(13,HIGH);
delay(1000);
digitalWrite(13,LOW);
delay(1000);
}
//Com.print("x");
}
DX160.h
#include "WConstants.h"
#include "SoftwareSerial.h"
#ifndef DX160_h
#define DX160_h
class DX160
{
public:
void init(int baud);
void helloWorld();
SoftwareSerial Com(uint8_t receivePin = 0, uint8_t transmitPin = 1);
private:
};
#endif
Essentially, anytime I want to use the SoftwareSerial commands (in this case, Com.print or Com.begin), I get that error message mentioned above.
I know that I am defining things all over the place, feel free to tell me what I do and do not need.
Thanks