Skip to content

MCU to MCU Robust Communication Library Protocol Based on Arduino Serial

License

Notifications You must be signed in to change notification settings

shuvangkardas/SerialPipe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SerialPipe

Build Status GitHub release GitHub commits MIT License LinkedIn

Bidrectional peer to peer library

This is a simple bidirectional communication library in between two microcontrollers. So, the main advantage of the library is that any microcontroller can send data to other microcontroller like send(opcode,data) and the other microcontroller send acknowledge if data packet is valid. Depending on the opcode the microcontroller can interprete the data and performs different actions.

Sender Example

int opcode  = 10;
char data[] = "Sample data block"
pipe.send(opcode, data);

Receiver Example

char readBuf[100];
int opCode = pipe.getOpcode();
if (opCode > 0)
{
    switch(opCode)
    {
        case 10:
            Serial.println(pipe.read(readBuf));
            pipe.ack();
        break;
        case 12:
            //perform different action
        break;
    }
}

Internal Library Opcode

The user cannot use opcode 0 to 9 for normal transaction. These opcodes are used by internal library

  • 1 -> for connection check

Library Tested with

  • Arduino Uno to Arduino Uno
  • Arduino Uno to ESP8266

About

MCU to MCU Robust Communication Library Protocol Based on Arduino Serial

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages