user40640: I want to communicate with an RS485 Bus consisting of 5 Arduino Pro Minis as slaves and one Arduino Mega 2560 as Master. I found a great library for this.
According to the documentation provided by the author of library I can use:
ICSC icsc(1, 9600, 7); //ID, BaudRate, DEpin
But I also have to define a Serial port for ICSC to work with:
ICSC icsc(1, 9600, Serial1);
I cannot mix these two sentences. I mean I cannot define both DEpin and Serial port for the ICSC in one sentence. But I need it to be defined. I don't want to use Serial for that, which I need for Serial Monitor. I want to use Serial1 for this. What can I do? I couldn't find any updated documentation about this.
UPDATE:
I found out how to define Serial port and DEpin for ICSC. The problem is I cannot get an answer!
Here is Master code:
#include <ICSC.h>
ICSC icsc(Serial1, 1, 7); //Stream, ID, DEpin

void setup() {
  Serial.begin(9600);
  Serial1.begin(9600);
  icsc.begin();
  icsc.registerCommand('R', &showTemperature);
}

void loop() {
  icsc.send(2, 'T', 0, NULL);
  icsc.process();
}

void showTemperature() {
  Serial.println("ACK");
}

And here is the Slave code:
#include <ICSC.h>
ICSC icsc(Serial, 2, 7); //Stream, ID, DEpin
String strAck = "ProMini2:ACK";

void setup() {
  Serial.begin(9600);
  icsc.begin();
  icsc.registerCommand('T', &sendTemperature);
}

void loop() {
  icsc.process();
}

void sendTemperature() {
  icsc.send(1, 'R', sizeof(strAck) + 1, (char*)&strAck);
}

Assume that there is just one slave and one master. I tried this code but got no answer. Where is the error?

user27653: The documentation for the library notes a few different possible initialization methods:
ICSC.begin(stationId, baudRate);
ICSC.begin(stationId, baudRate, &SerialPort);
ICSC.begin(stationId, baudRate, &SerialPort, DEPin);
ICSC.begin(stationId, baudRate, DEPin);

So, if you need to define both a serial port and DE Pin, use the third option.
EDIT: Disregard this answer, as the library has changed initialization methods.

user4143: The documentation for the constructors is out of date (I am re-writing as we speak, and is now here).
The constructors in the header file are like this:
ICSC(Stream *d, uint8_t station);
ICSC(Stream &d, uint8_t station);
ICSC(Stream *d, uint8_t station, int depin);
ICSC(Stream &d, uint8_t station, int depin);

That means you need to provide the serial object as the first entry:
ICSC icsc(Serial1, 'A', 5);

You need to manually start the serial object before ICSC.
void setup() {
    Serial1.begin(9600);
    icsc.begin();
}

This change was made to enable support for software serial and other Stream based devices.

Addendum for your update:

Don't spam the sending like you are. Send periodically, not constantly, or you will never be able to receive.
You cannot use String objects like that. 
1 and 2 aren't good choices of station IDs. Yes, they work, but not great, since 1 is the SOH character.


40640: <p>I want to communicate with an RS485 Bus consisting of 5 Arduino Pro Minis as slaves and one Arduino Mega 2560 as Master. I found <a href="https://github.com/MajenkoLibraries/ICSC" rel="nofollow noreferrer">a great library</a> for this.</p>

<p>According to the documentation provided by the author of library I can use:</p>

<p><code>ICSC icsc(1, 9600, 7); //ID, BaudRate, DEpin</code></p>

<p>But I also have to define a Serial port for ICSC to work with:</p>

<p><code>ICSC icsc(1, 9600, Serial1);</code></p>

<p>I cannot mix these two sentences. I mean I cannot define both <strong>DEpin</strong> and <strong>Serial port</strong> for the ICSC in one sentence. But I need it to be defined. I don't want to use Serial for that, which I need for Serial Monitor. I want to use Serial1 for this. What can I do? I couldn't find any updated documentation about this.</p>

<p><strong>UPDATE</strong>:</p>

<p>I found out how to define Serial port and DEpin for ICSC. The problem is I cannot get an answer!</p>

<p>Here is Master code:</p>

<pre><code>#include &lt;ICSC.h&gt;
ICSC icsc(Serial1, 1, 7); //Stream, ID, DEpin

void setup() {
  Serial.begin(9600);
  Serial1.begin(9600);
  icsc.begin();
  icsc.registerCommand('R', &amp;showTemperature);
}

void loop() {
  icsc.send(2, 'T', 0, NULL);
  icsc.process();
}

void showTemperature() {
  Serial.println("ACK");
}
</code></pre>

<p>And here is the Slave code:</p>

<pre><code>#include &lt;ICSC.h&gt;
ICSC icsc(Serial, 2, 7); //Stream, ID, DEpin
String strAck = "ProMini2:ACK";

void setup() {
  Serial.begin(9600);
  icsc.begin();
  icsc.registerCommand('T', &amp;sendTemperature);
}

void loop() {
  icsc.process();
}

void sendTemperature() {
  icsc.send(1, 'R', sizeof(strAck) + 1, (char*)&amp;strAck);
}
</code></pre>

<p>Assume that there is just one slave and one master. I tried this code but got no answer. Where is the error?</p>
 27653: <p>The documentation for the library notes a few different possible initialization methods:</p>

<pre><code>ICSC.begin(stationId, baudRate);
ICSC.begin(stationId, baudRate, &amp;SerialPort);
ICSC.begin(stationId, baudRate, &amp;SerialPort, DEPin);
ICSC.begin(stationId, baudRate, DEPin);
</code></pre>

<p>So, if you need to define both a serial port and DE Pin, use the third option.</p>

<p><strong>EDIT:</strong> Disregard this answer, as the library has changed initialization methods.</p>
 4143: <p>The documentation for the constructors is out of date (I am re-writing as we speak, and is now <a href="https://github.com/MajenkoLibraries/ICSC/tree/master/docs" rel="nofollow noreferrer">here</a>).</p>

<p>The constructors in the header file are like this:</p>

<pre><code>ICSC(Stream *d, uint8_t station);
ICSC(Stream &amp;d, uint8_t station);
ICSC(Stream *d, uint8_t station, int depin);
ICSC(Stream &amp;d, uint8_t station, int depin);
</code></pre>

<p>That means you need to provide the serial object as the first entry:</p>

<pre><code>ICSC icsc(Serial1, 'A', 5);
</code></pre>

<p>You need to manually start the serial object before ICSC.</p>

<pre><code>void setup() {
    Serial1.begin(9600);
    icsc.begin();
}
</code></pre>

<p>This change was made to enable support for software serial and other Stream based devices.</p>

<hr>

<p>Addendum for your update:</p>

<ol>
<li>Don't spam the sending like you are. Send periodically, not constantly, or you will never be able to receive.</li>
<li>You cannot use String objects like that. </li>
<li>1 and 2 aren't good choices of station IDs. Yes, they work, but not great, since 1 is the SOH character.</li>
</ol>
