I'm writing a library and I'd like to use AltSoftSerial instead of NewSoftSerial but can't seem to get it to work inside the library. Here's the simplified code I'm using. It works fine with NSS (the commented sections) but outputs gibberish when I switch to AltSoftSerial. It's not a baud rate issue on the output as I'm looking at it on an analyzer and it's definitely gibberish. Any help would be appreciated.
.h file
#include <AltSoftSerial.h>
//#include <NewSoftSerial.h>
#ifndef testAlt_h
#define testAlt_h
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
class testAlt
{
public:
testAlt();
void init();
private:
AltSoftSerial soft;
//NewSoftSerial soft;
};
#endif
.cpp file
#include "testAlt.h"
testAlt::testAlt() /* : soft(8,9)*/
{
soft.begin(9600);
}
void testAlt::init()
{
soft.println("test");
}
Arduino 022 sketch
#include <testAlt.h>
#include <AltSoftSerial.h>
//#include <NewSoftSerial.h>
testAlt test;
void setup(){}
void loop()
{
test.init();
delay(1000);
}