Go Down

Topic: Attiny 85 with SoftwareSerial library (Read 870 times) previous topic - next topic

Vincent19

Dear all,

I am currently doing a project using a bluetooth module where I try to control a LED wirelessly through a bluetooth module and attiny 85 - to save pins.

This is the error that I got when compile it.

What is the problem actually ?

Thank you for your experience.

MichaelMeissner

#1
Nov 01, 2013, 03:34 pm Last Edit: Nov 01, 2013, 03:36 pm by MichaelMeissner Reason: 1
I believe the trouble is the SoftwareSerial library was written for the earlier versions of Arduino, such as the 0.22 release.  In that version, the write function did not return anything (i.e. it had a void return).  In the 1.0 release and beyond, write now returns the amount of bytes that were actually written (i.e. the return type is size_t).

You would presumably need to modify the .h file to change the calling signature to size_t write (...), and then change the .cpp file to return a 1 in the write functions.

I would imagine that somebody else has already done this, and you might be able to find a newer version of SoftwareSerial.

PaulS

Quote
and you might be able to find a newer version of SoftwareSerial.

Like the one that ships with 1.0+.

Vincent19


Quote
and you might be able to find a newer version of SoftwareSerial.

Like the one that ships with 1.0+.


Well, I tried it with arduino 1.0.5. I get this problem. So I could not figure out what is the problem exactly :(

MichaelMeissner


Well, I tried it with arduino 1.0.5. I get this problem. So I could not figure out what is the problem exactly :(

Do you have your own version of SoftwareSerial sitting in your hardware directory in the sketchbook?  I believe that would preempt the system one.

Vincent19



Well, I tried it with arduino 1.0.5. I get this problem. So I could not figure out what is the problem exactly :(

Do you have your own version of SoftwareSerial sitting in your hardware directory in the sketchbook?  I believe that would preempt the system one.

What do you mean by own version of SoftwareSerial ?

Thanks !

MichaelMeissner


What do you mean by own version of SoftwareSerial ?
Thanks !

If you load a board support package for a processor, it includes files that override the standard definition for header files.  If that board support package was built a few years ago and targeted the older release of the Arduino IDE, it would bring in the standard print header file, and one function (write) changed to have a different calling sequence.  So I imagine if you look around for a newer version of the board support package, and replace your version with the newer one, it may work better.

Similarly, in your sketchbook directory you can have two directories (libraries and hardware) that are searched before the standard versions.

Vincent19



What do you mean by own version of SoftwareSerial ?
Thanks !

If you load a board support package for a processor, it includes files that override the standard definition for header files.  If that board support package was built a few years ago and targeted the older release of the Arduino IDE, it would bring in the standard print header file, and one function (write) changed to have a different calling sequence.  So I imagine if you look around for a newer version of the board support package, and replace your version with the newer one, it may work better.

Similarly, in your sketchbook directory you can have two directories (libraries and hardware) that are searched before the standard versions.

What I found so far is that, no new softwareserial. Newsoftserial == softwareserial for arduino 1.0 and above.

Any advice ?

Erni

Are you sure that this version of SoftwareSerial you are using, is from Arduino 1..0.x ?

Code: [Select]
C::\Program Files(x86)\Arduino\libraries\SoftwareSerial/SoftwareSeial.h

Try to replace it and the coresponding .cpp file with the ones that comes with 1.0.x

Vincent19


Are you sure that this version of SoftwareSerial you are using, is from Arduino 1..0.x ?

Code: [Select]
C::\Program Files(x86)\Arduino\libraries\SoftwareSerial/SoftwareSeial.h

Try to replace it and the coresponding .cpp file with the ones that comes with 1.0.x

I downloaded Arduino V1.0.5. So i think the SoftwareSerial is the newest version.

Any advice ?

Thank yo.

PaulS

Quote
C::\Program Files(x86)\Arduino\libraries\SoftwareSerial/SoftwareSeial.h

This looks like a user-downloaded library file, not the core library file. If is IS a user-downloaded library location, delete the SoftwareSerial directory.

Vincent19


Quote
C::\Program Files(x86)\Arduino\libraries\SoftwareSerial/SoftwareSeial.h

This looks like a user-downloaded library file, not the core library file. If is IS a user-downloaded library location, delete the SoftwareSerial directory.

But it come along when I download the arduino 1.0.5 file. Why you would say that it is user-downloaded library file ?

Thanks!

PaulS

Quote
But it come along when I download the arduino 1.0.5 file. Why you would say that it is user-downloaded library file ?

Because the install path for the Arduino IDE and related code usually has the version number in the path. The sketch directory usually does not. Therefore, when I see a path without a version number, I assume that it is a sketch directory, and that is where user-downloaded libraries go. There are good reasons for following conventions.

Vincent19


Quote
But it come along when I download the arduino 1.0.5 file. Why you would say that it is user-downloaded library file ?

Because the install path for the Arduino IDE and related code usually has the version number in the path. The sketch directory usually does not. Therefore, when I see a path without a version number, I assume that it is a sketch directory, and that is where user-downloaded libraries go. There are good reasons for following conventions.

So what should I do now ? Redownload the IDE ?

Thank you

PaulS

Quote
So what should I do now ? Redownload the IDE ?

Instead of telling us whether or not that directory really is your sketch directory? I can't see how downloading the IDE again will be a satisfactory alternative.

If that IS your sketch directory, downloading the IDE again will leave it exactly the same, so your problem won't have gone away. Again, I don't see downloading the IDE again as a useful thing to do.

If that IS your sketch directory, deleting the SoftwareSerial folder WILL solve your problem.

But, it's your decision as to what to do.

Go Up