Pages: [1]   Go Down
Author Topic: NewSoftSerial 10C Compile errors  (Read 1170 times)
0 Members and 1 Guest are viewing this topic.
Australia
Offline Offline
Jr. Member
**
Karma: 0
Posts: 66
Power up to your potential
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Code:
#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
    }
}

Logged


Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 212
Posts: 13085
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


Which version of the Arduino IDE are you using?
Logged

Austin, TX USA
Offline Offline
God Member
*****
Karma: 5
Posts: 998
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No need to use NewSoftSerial in Arduino 1.0 -- it's built in!  (... under the name SoftwareSerial).
Logged

Australia
Offline Offline
Jr. Member
**
Karma: 0
Posts: 66
Power up to your potential
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

We are using 1.0 RC2. Does that mean SoftwareSerial the same as NewSoftSerial v10C?

The only reason to move to NewSoftSerial is that SoftwareSerial only seems to work reliably at 2400 baud, less reliably at 4800 and not at all well at 9600.
Logged


Pages: [1]   Go Up
Jump to: