Software serial Library
-
Hello,
MySensors :API is compatible with the softwareserial Library?
I have some errors when i compile my sketch:
SoftwareSerial\SoftwareSerial.cpp.o: In function__vector_3': C:\temp\libraries\SoftwareSerial/SoftwareSerial.cpp:305: multiple definition of
__vector_3'
MySensors\MyGateway.cpp.o:/utility/PinChangeInt.h:563: first defined here
SoftwareSerial\SoftwareSerial.cpp.o: In function__vector_4': C:\temp\libraries\SoftwareSerial/SoftwareSerial.cpp:312: multiple definition of
__vector_4'
MySensors\MyGateway.cpp.o:/utility/PinChangeInt.h:573: first defined here
SoftwareSerial\SoftwareSerial.cpp.o: In function__vector_5': C:\temp\libraries\SoftwareSerial/SoftwareSerial.cpp:319: multiple definition of
__vector_5'regards
MySensors\MyGateway.cpp.o:/utility/PinChangeInt.h:583: first defined here
-
I get the same error when using the SoftwareSerial library. More specific, it is a known limitation that you cannot use SoftwareSerial.h and PinChangeInt.h together without altering one or another.
Let me give you an example, I was in the same case as you are now, I wanted to use an RF ID reader (125 kHz - RDM6300) on a software serial pin, in my case was A2 (don't ask why, this was the only input pin that I have on an UNO, it is stuffed with keyboard, display, motor actuator for door opening, button for manual door opening, ringer button and NRF24 - this is my all in one entrance sensor
). So, what you have to do:
pin A2 is on Port C
- you have to disable in the SoftwareSerial.h the other intrerupts, except the one associated to PortC, that would be - PCINT1 is for Port C :
PCINT0 is for Port B
PCINT2 is for Port D
PCINT3 - it is not the case of 328P so you can leave it uncommentedso in SoftwareSerial.h comment the following for PCINT0 and 2:
#if defined(PCINT0_vect)
ISR(PCINT0_vect)
{
ReceiveOnlySoftwareSerial::handle_interrupt();
}
#endifThe other thing that you have to do now is to tell PinChangeInt.h that you use Port C for other purpose. To do this, in MyGateway.cpp, ahead of the #include "utility/PinChangeInt.h" you should include the following:
#define NO_PORTC_PINCHANGES
Save, upload, enjoy... And don't forget to modify back what you altered.
This assumes that you don't use intrerupts on pins...
Suggested Topics
-
Arduino Celebrates 10 years (Malmö/Sweden)
Announcements • 29 Mar 2014, 17:08 • hek 29 Mar 2014, 17:08 -
Gateway without a radio
Development • 12 Jan 2025, 23:19 • OldSurferDude 14 Jan 2025, 22:07 -
MQTT-Help me understand about the MQTT Gateway.
Development • 2 Mar 2025, 01:44 • dpcons 20 days ago -
Counting Incoming and Outgoing Messages from a Gateway
Development • 10 Dec 2024, 21:57 • Trand 14 Dec 2024, 20:23 -
Sending offset to node
Development • 31 Jan 2025, 00:59 • bsl88k 4 Feb 2025, 12:14 -
Radio waking up for no reason.
Development • 4 Jul 2020, 21:09 • Sasquatch 15 Jan 2025, 08:33