I need some help.
I am trying to user Arduino mini pro to make a RS232 as a loop.
And I see the softwareserial could simulate the comport.
So, I use the example code and did some change
but it never worked out right.
So what I want is to have PortOne send tx PortTwo, print at original Serial port (Monitor serial port)
or PortTwo send tx back to PortOne, print at Serial port.
I am not sure it's doable to be for using softwareserial at Arduino mini pro.
but I know like Due has multiple serial port and it's doable but not sure about the softwareserial.
Thanks.
#include <SoftwareSerial.h>
// software serial : TX = digital pin 10, RX = digital pin 11
SoftwareSerial portOne(10, 11);
// software serial : TX = digital pin 8, RX = digital pin 9
SoftwareSerial portTwo(8, 9);
void setup()
{
// Start the hardware serial port
Serial.begin(9600);
// Start both software serial ports
portOne.begin(9600);
portTwo.begin(9600);
Here is the reason why I asked it and again, thanks on helping it.
On hand I have one Due and 5V mini pro. Due is doable for my task but it's a 3.3V signal and I need a logic 3->5 level shift because the target board is 5V. Also I kind of don't want to waste the Due to just using those 2 serial port only.
Then, I see there is a softwareserial library can use, but kind of don't understand how to make it work.
So, I was thinking using the 5V mini pro can simulate two comport and they could send package back and forth. During the transmitting and receiving, I could make sure the (Target board) is working properly.
I m trying to make a simple tester to test RS232 to RS485 converter (Target board)
it will be COM1 <--> converter (RS232-->RS485) <--> converter (RS485-->RS232) <-->COM2
Software serial is pretty crap. You can't send and receive at the same time or you get gibberish, only one can be active at the same time, it blocks while sending or receiving (whereas with hardware serial, if you write something smaller than the buffer, your code continues, and every time it's done sending out a byte, an interrupt fires and reloads the UART with the next byte)
You might want to look into the Mega2560 (clones aren't that expensive on ebay) which has 4 serial ports, or a 1284p-based board (crossroads on these forums sells them, and a couple of other vendors do too), which is sort of in-between the '2560 and the '328p - it's got 128k flash, 16k sram, 2 serials, and 32 IO pins. Or if the task is super simple, an ATTiny1634 or attiny841 might do it - both of those have 2 hardware serial ports, with 16k and 8k flash respectively (see my sig for IDE support, I happen to sell '1634 and '841 boards on my Tindie shop - which of course means I'm also biased in favor of them)
Kwangliu:
So, I was thinking using the 5V mini pro can simulate two comport and they could send package back and forth. During the transmitting and receiving, I could make sure the (Target board) is working properly.
If there is no need to connect the pro-mini to a PC then you could use HardwareSerial for one of the ports and SoftwareSerial for the other.