Initializes the RS485 object communication speed.
RS485.begin(baudrate)
- baudrate: communication speed in bits per second (baud).
None.
- end()
- available()
- peek()
- read()
- write()
- flush()
- beginTransmission()
- endTransmission()
- receive()
- noReceive()
- sendBreak()
- sendBreakMicroseconds()
- setPins()
Disables RS485 communication.
RS485.end()
None.
None.
- begin()
- available()
- peek()
- read()
- write()
- flush()
- beginTransmission()
- endTransmission()
- receive()
- noReceive()
- sendBreak()
- sendBreakMicroseconds()
- setPins()
Get the number of bytes (characters) available for reading from the RS485 port. This is data that already arrived and is stored in the serial receive buffer.
RS485.available()
None.
The number of bytes available to read.
- begin()
- end()
- peek()
- read()
- write()
- flush()
- beginTransmission()
- endTransmission()
- receive()
- noReceive()
- sendBreak()
- sendBreakMicroseconds()
- setPins()
Returns the next byte (character) of the incoming serial data without removing it from the internal serial buffer. That is, successive calls to peek() will return the same character, as will the next call to read().
RS485.peek()
None.
The first byte of incoming serial data available or -1 if no data is available.
- begin()
- end()
- available()
- read()
- write()
- flush()
- beginTransmission()
- endTransmission()
- receive()
- noReceive()
- sendBreak()
- sendBreakMicroseconds()
- setPins()
Reads incoming serial data.
RS485.read()
None.
The first byte of incoming serial data available or -1 if no data is available.
- begin()
- end()
- available()
- peak()
- write()
- flush()
- beginTransmission()
- endTransmission()
- receive()
- noReceive()
- sendBreak()
- sendBreakMicroseconds()
- setPins()
Writes binary data to the serial port. This data is sent as a byte or series of bytes.
RS485.write(uint8_t b)
- b: unsigned char.
The number of bytes written.
- begin()
- end()
- available()
- peak()
- read()
- flush()
- beginTransmission()
- endTransmission()
- receive()
- noReceive()
- sendBreak()
- sendBreakMicroseconds()
- setPins()
Waits for the transmission of outgoing serial data to complete.
RS485.flush()
None.
None.
- begin()
- end()
- available()
- peak()
- read()
- write()
- beginTransmission()
- endTransmission()
- receive()
- noReceive()
- sendBreak()
- sendBreakMicroseconds()
- setPins()
Enables RS-485 transmission.
RS485.beginTransmission()
None.
None.
#include <ArduinoRS485.h>
int counter = 0;
void setup() {
RS485.begin(9600);
}
void loop() {
RS485.beginTransmission();
RS485.print("Counter: ");
RS485.println(counter);
RS485.endTransmission();
counter++;
delay(1000);
}
- begin()
- end()
- available()
- peak()
- read()
- write()
- flush()
- endTransmission()
- receive()
- noReceive()
- sendBreak()
- sendBreakMicroseconds()
- setPins()
Disables RS-485 transmission.
RS485.endTransmission()
None.
None.
#include <ArduinoRS485.h>
int counter = 0;
void setup() {
RS485.begin(9600);
}
void loop() {
RS485.beginTransmission();
RS485.print("Counter: ");
RS485.println(counter);
RS485.endTransmission();
counter++;
delay(1000);
}
- begin()
- end()
- available()
- peak()
- read()
- write()
- flush()
- beginTransmission()
- receive()
- noReceive()
- sendBreak()
- sendBreakMicroseconds()
- setPins()
Enables reception.
RS485.receive()
None.
None.
#include <ArduinoRS485.h>
void setup() {
Serial.begin(9600);
while (!Serial);
RS485.begin(9600);
// Enable data reception
RS485.receive();
}
void loop() {
if (RS485.available()) {
Serial.write(RS485.read());
}
}
- begin()
- end()
- available()
- peak()
- read()
- write()
- flush()
- beginTransmission()
- endTransmission()
- noReceive()
- sendBreak()
- sendBreakMicroseconds()
- setPins()
Disables reception.
RS485.noReceive()
None.
None.
- begin()
- end()
- available()
- peak()
- read()
- write()
- flush()
- beginTransmission()
- endTransmission()
- receive()
- sendBreak()
- sendBreakMicroseconds()
- setPins()
Sends a serial break signal for the specified duration in milliseconds.
RS485.sendBreak(unsigned int duration)
- duration: Duration of the break signal in milliseconds.
None.
- begin()
- end()
- available()
- peak()
- read()
- write()
- flush()
- beginTransmission()
- endTransmission()
- receive()
- noReceive()
- sendBreakMicroseconds()
- setPins()
Sends a serial break signal for the specified duration in microseconds.
RS485.sendBreak(unsigned int duration)
- duration: Duration of the break signal in microseconds.
None.
- begin()
- end()
- available()
- peak()
- read()
- write()
- flush()
- beginTransmission()
- endTransmission()
- receive()
- noReceive()
- sendBreak()
- setPins()
Modify the pins used to communicate with the MAX3157 chipset. By default the library uses pin 14 for TX, pin A6 for drive output enable, and pin A5 for receiver output enable.
RS485.setPins(int txPin, int dePin, int rePin)
- txPin: transmission pin (used to send break signals).
- dePin: drive output enable pin.
- rePin: receiver output enable pin.
None.