Pages: [1] 2   Go Down
Author Topic: Attiny 85 with SoftwareSerial library  (Read 559 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Sr. Member
****
Karma: 2
Posts: 336
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.


* Untitled.png (9.33 KB, 495x289 - viewed 23 times.)
Logged

Ayer, Massachusetts, USA
Offline Offline
Edison Member
*
Karma: 53
Posts: 1835
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: November 01, 2013, 09:36:23 am by MichaelMeissner » Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 601
Posts: 48554
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
and you might be able to find a newer version of SoftwareSerial.
Like the one that ships with 1.0+.
Logged

Offline Offline
Sr. Member
****
Karma: 2
Posts: 336
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley-sad
Logged

Ayer, Massachusetts, USA
Offline Offline
Edison Member
*
Karma: 53
Posts: 1835
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Well, I tried it with arduino 1.0.5. I get this problem. So I could not figure out what is the problem exactly smiley-sad
Do you have your own version of SoftwareSerial sitting in your hardware directory in the sketchbook?  I believe that would preempt the system one.
Logged

Offline Offline
Sr. Member
****
Karma: 2
Posts: 336
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well, I tried it with arduino 1.0.5. I get this problem. So I could not figure out what is the problem exactly smiley-sad
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 !
Logged

Ayer, Massachusetts, USA
Offline Offline
Edison Member
*
Karma: 53
Posts: 1835
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Sr. Member
****
Karma: 2
Posts: 336
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 ?
Logged

Denmark
Offline Offline
Edison Member
*
Karma: 35
Posts: 1057
Happy Hobbyist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Code:
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
Logged

Offline Offline
Sr. Member
****
Karma: 2
Posts: 336
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Code:
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.
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 601
Posts: 48554
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Sr. Member
****
Karma: 2
Posts: 336
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 601
Posts: 48554
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Sr. Member
****
Karma: 2
Posts: 336
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 601
Posts: 48554
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1] 2   Go Up
Jump to: