user34035: I want to have two RF transceivers communicate, one as transmitter and one as a receiver, for longer distances. For that I'm using WIR 1186 RF modules with Arduino.
Pin connections are as below:

Arduino :5v,gnd,RX,TX,2,3
WIR1186 :VCC,gnd,Tx,Rx,prg,cts

But Arduino is not serially communicating with the WIR1186 module.
Below is the code:
char ch;
int prog = 2;
int cts = 3;
int stat;
unsigned int output;

void setup() {
  Serial.begin(9600);
  pinMode(prog, OUTPUT);
  digitalWrite(prog, LOW);
  stat = digitalRead(prog);
  Serial.println(stat);  
  Serial.write("B=9600\r\n");
  output = Serial.read();
  Serial.println(output); 
  digitalWrite(cts, HIGH);
}

void loop() {
  Serial.write('a');
  delay(1000);
}

Here is the datasheet of WIR1186
Please help me out with this.

user1576: If you use pin 2 and 3 for serial communication you have to use SoftSerial, because Serial is hardwired to pin 0 and 1.

user4143: Two things are wrong:

You aren't setting PROG to HIGH to enable transmit mode - you are stuck in programming mode.
CTS is an output from the module to an input on the Arduino. You don't set it high - you look to see what level it is to see if it is safe to send more data.

To quote from the datasheet you link to:

The WIR-1186 offers data flow control hardware to allow for zero data over-run and loss when sending large
files and data packets. The internal data buffer on the WIR-1186 module is 128bytes. When the data terminal1
sends a large file for wireless transmission the module2 will except 128bytes and then set the CTS pin LOW to
alert the data terminal to wait for the CTS to back HIGH before sending more data over UART.

(footnotes mine)
Also you cannot use pins 0 and 1 for serial if you are at the same time using them for USB debugging. You will either have to move to another pair of pins and use SoftwareSerial, or invest in a better Arduino with more than one UART.
Another thing of importance: If your WIR-1186 isn't on some kind of carrier board with voltage regulator and logic level translation it's safe to say that you have killed it. Well done.

Warnings

The maximum allowable voltage on any of the interface pins with respect to GND is 3.6V
The maximum input voltage VCC with respect to GND is 3.6V
The baud rate setting in configure mode is fixed 9600bps
Do not leave the UART_TX input pin of the module open. The module will send junk data on thewireless channel. It must be pulled up to VCC if not used.



1 Arduino
2 WIR-1186

34035: <p>I want to have two RF transceivers communicate, one as transmitter and one as a receiver, for longer distances. For that I'm using WIR 1186 RF modules with Arduino.</p>

<p>Pin connections are as below:</p>

<ul>
<li>Arduino :5v,gnd,RX,TX,2,3</li>
<li>WIR1186 :VCC,gnd,Tx,Rx,prg,cts</li>
</ul>

<p>But Arduino is not serially communicating with the WIR1186 module.</p>

<p>Below is the code:</p>

<pre><code>char ch;
int prog = 2;
int cts = 3;
int stat;
unsigned int output;

void setup() {
  Serial.begin(9600);
  pinMode(prog, OUTPUT);
  digitalWrite(prog, LOW);
  stat = digitalRead(prog);
  Serial.println(stat);  
  Serial.write("B=9600\r\n");
  output = Serial.read();
  Serial.println(output); 
  digitalWrite(cts, HIGH);
}

void loop() {
  Serial.write('a');
  delay(1000);
}
</code></pre>

<p><a href="http://robokits.download/datasheets/WIR-1186_RobokitsIndia.pdf" rel="nofollow noreferrer">Here is the datasheet of WIR1186</a></p>

<p>Please help me out with this.</p>
 1576: <p>If you use pin 2 and 3 for serial communication you have to use <a href="https://www.arduino.cc/en/Reference/SoftwareSerial" rel="nofollow noreferrer">SoftSerial</a>, because Serial is hardwired to pin 0 and 1.</p>
 4143: <p>Two things are wrong:</p>
<ol>
<li>You aren't setting PROG to HIGH to enable transmit mode - you are stuck in programming mode.</li>
<li>CTS is an <em>output from the module to an input on the Arduino</em>. You don't set it high - you look to see what level it is to see if it is safe to send more data.</li>
</ol>
<p>To quote from the datasheet you link to:</p>
<blockquote>
<p>The WIR-1186 offers data flow control hardware to allow for zero data over-run and loss when sending large
files and data packets. The internal data buffer on the WIR-1186 module is 128bytes. When the data terminal<sup>1</sup>
sends a large file for wireless transmission the module<sup>2</sup> will except 128bytes and then set the CTS pin LOW to
alert the data terminal to wait for the CTS to back HIGH before sending more data over UART.</p>
</blockquote>
<p>(footnotes mine)</p>
<p>Also you <em>cannot</em> use pins 0 and 1 for serial if you are at the same time using them for USB debugging. You will either have to move to another pair of pins and use <code>SoftwareSerial</code>, or invest in a better Arduino with more than one UART.</p>
<p>Another thing of importance: If your WIR-1186 isn't on some kind of carrier board with voltage regulator and logic level translation it's safe to say that you have killed it. Well done.</p>
<blockquote>
<h1>Warnings</h1>
<ul>
<li><strong>The maximum allowable voltage on any of the interface pins with respect to GND is 3.6V</strong></li>
<li><strong>The maximum input voltage VCC with respect to GND is 3.6V</strong></li>
<li>The baud rate setting in configure mode is fixed 9600bps</li>
<li>Do not leave the UART_TX input pin of the module open. The module will send junk data on thewireless channel. It must be pulled up to VCC if not used.</li>
</ul>
</blockquote>
<hr />
<p><sup>1</sup> Arduino
<sup>2</sup> WIR-1186</p>
