SimpleComm library to send data through any Arduino Stream

SimpleComm library to send data through any Arduino Stream

This is Industrial Shields library for different PLC’s 

With the SimpleComm library you can send data through any Arduino Stream: RS-485, RS-232, Ethernet… It is enough flexible to support different kind of communication typologies: Ad-hoc, Master-Slave, Client-Server… Using an easy to use API. The SimpleCoom library is included on Tools40 library.

Reference:

SimplePacket encapsulates the data into a packet and provides these functions:

setData(data)

Fill up the packet with the desired data to send or the received data from a remote device. It is possible to fill up the packet with different types of data: bool, char, unsigned char, int, unsigned int, long, unsigned long, double, const, const char, const void (the maximum data length is 128 bytes).

getBool()

getChar()

getUChar()

getInt()

getUInt()

getLong()

getLong()

getDouble()

getString()

getData(len)

Return the data contained in the packet, depending on the data type. If length is specified, it returns the data length in bytes.

SimpleComm is the interface for sending and receiving packets through the desired Arduino Stream:

begin(address)

Enable the communication system and set the device identifier/address. The address is used to identify each device. The device receives packets that are sent to it, but not to others.

send(stream, packet, destination)

send(stream, packet, destination, type)

Send a packet to a destination device, using the stream. It is also possible to define the packet type.

receive(stream, packet)

Receive a packet sent to me from another device, using the stream. It returns true if a packet is received.

How to install the Tools40 library in the Arduino IDE.

  1. Download the Tools40 library from the GitHub. Click on: “Clone or download”. After that download the zip file on your desktop.
  2. Add the library on the Arduino IDE. Click on: Sketch–>Include library–>Add .ZIP library and choose “arduino-Tools40-master.zip”. After choose the arduino-Tools40-master.zip the library has to be charged. To verify the library is added correctly you can see the library on: //File–>Examples–>Tools40
  3. Now your library is correctly installed and you can see an example to how to use that library on our PLCs.

See Also:

RS-485RS485 AND RS232 IMPLEMENTATION

Comments are closed.