Before I added SoftwareSerial, this worked fine. Now it won't compile. I really need to use both together.
Get this:
PinChangeInterrupt.a(PinChangeInterrupt1.cpp.o):In function __vector_4 PinChangeInterrupt1.cpp:multiple definition of
__vector_4
SoftwareSerial.cpp.o:C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SoftwareSerial\src\SoftwareSerial.cpp:229: first defined here
collect2.exe:error: ld returned 1 exit status
Error creating .elf
Any thoughts?
#include "PinChangeInterrupt.h"
#include <SoftwareSerial.h>
// Choose a valid PinChangeInterrupt pin of your Arduino board
#define busWrtADC A5
#define busWrtDAC A4
#define t 8
#define r 9
SoftwareSerial mySerial = SoftwareSerial(r, t);
void setup() {
pinMode(r, INPUT);
pinMode(t, OUTPUT);
pinMode(busWrtADC, INPUT_PULLUP);
pinMode(busWrtDAC, INPUT_PULLUP);
mySerial.begin(9600);
// Attach the new PinChangeInterrupt and enable event function below
attachPCINT(digitalPinToPCINT(busWrtADC), adc, CHANGE);
attachPCINT(digitalPinToPCINT(busWrtDAC), dac, CHANGE);
mySerial.begin(9600);
}
void adc(void) {
mySerial.println("adc");
}
void dac(void) {
mySerial.println("dac");
}
void loop() {
// Nothing to do here
mySerial.println("main");
delay(100);
}