Hi,
I already connected Voice Recognition(EasyVR) to Arduino UNO - p2(rx) and p3(tx).
However, I need to connect other module to Arduino UNO for communication. So is there other rx and tx? If yes, how to write code?
Thanks
Hi,
I already connected Voice Recognition(EasyVR) to Arduino UNO - p2(rx) and p3(tx).
However, I need to connect other module to Arduino UNO for communication. So is there other rx and tx? If yes, how to write code?
Thanks
Use softwareserial for more unique serial connections.
Yes. I already did. Below is my softwareserial program
SoftwareSerial tx(30,3);// tx on 14 for easyvr
SoftwareSerial rx(2,30);// rx on 12 for easyvr
SoftwareSerial tx1(30, 1);//tx for other module
SoftwareSerial tx1(0, 30);//rx for other module
is that correct?
I don't believe so.
I would expect more like this:
#include <SoftwareSerial.h> // goes at top of sketch with other includes, before any code
SoftwareSerial easyVR(2,3); // RX, TX
SoftwareSerial otherSerial(4,5); // other Rx, Tx pins
with names & pins as needed to make your code clear.
SoftwareSerial tx(30,3);// tx on 14 for easyvr
SoftwareSerial rx(2,30);// rx on 12 for easyvr
My easyvr program is working with above.
Thus, I think I cannot change that above.
Is there other way?
Okay, that may compile, I think what you have done is created two instances of ports tho.
One called 'tx' that uses pin 30 for its RX and pin 3 for TX
and one called 'rx' that uses pin 2 for its RX and pin 30 for TX
so if you only transmit on tx (pin3), and only receive on rx (pin2),
you are avoiding the dual use of pin 30 for both serial ports.
#include <SoftwareSerial.h>
SoftwareSerial tx(30,3);// tx on 14 for easyvr
SoftwareSerial rx(2,30);// rx on 12 for easyvr
void setup(){
tx.begin(9600);
rx.begin(9600);
}
void loop(){}
Correct usage would be as I called out:
#include <SoftwareSerial.h>
SoftwareSerial easyVR(2,3);// rx, tx for easyvr
SoftwareSerial otherSerial(4,5);// rx, tx for other serial
void setup(){
easyVR.begin(9600);
otherSerial.begin(9600);
}
void loop(){}
Oh! Thanks! I got it! I am going to try change and see if it's working. =)
Ok, good luck!