I am trying to comple a project using the NewSoftSerial v10c library. I get the following errors:
In file included from WT12A_newsoft.cpp:1:
C:_projects\Arduino\arduino-1.0-rc2\libraries\NewSoftSerial/NewSoftSerial.h:86: error: ISO C++ forbids declaration of 'write' with no type
C:_projects\Arduino\arduino-1.0-rc2\libraries\NewSoftSerial/NewSoftSerial.h:86: error: 'int NewSoftSerial::write(uint8_t)' cannot be overloaded
C:_projects\Arduino\arduino-1.0-rc2\libraries\NewSoftSerial/NewSoftSerial.h:86: error: with 'virtual size_t NewSoftSerial::write(uint8_t)'
Here is the code. Works fine with SoftwareSerial
#include <NewSoftSerial.h>
// Arduino Shields WT12A Bluetooth Shield demo code
// www.arduino.com.au
// v1.00 13-Oct-2011 - first release
// tested on Arduino Uno
//#include <SoftwareSerial.h>
#define rxPin 2 // define receive pin for serial port 2
#define txPin 3 // define transmit pin for serial port 2
//SoftwareSerial mySerial = SoftwareSerial(rxPin, txPin); // define serial port 2
NewSoftSerial mySerial(rxPin,txPin);
byte serialin = 0; // for incoming serial data
void setup()
{
pinMode(rxPin, INPUT); // rxpin iput fopr serial port 2
pinMode(txPin, OUTPUT);
mySerial.begin(2400); // talk to WT12A at 2400 baud
Serial.begin(9600); // std serial port set to 9600 baud
mySerial.print("SET\r\n"); // send out SET to read all settings
}
void loop()
{
while (Serial.available()) { // check if data has been sent from the computer:
serialin = Serial.read(); // read serial byte
mySerial.write(serialin); // and send to WT12A bluetooth module
serialin = mySerial.read(); // if WT12A data, read and show
if ((serialin<0x7f) && ( serialin>0x09)) {
Serial.write(serialin);
}
}
serialin = mySerial.read(); // read WT12A serial data
if ((serialin<0x7f) && ( serialin>0x09)) {
Serial.write(serialin); // display if valid ascii
}
}