Skip to content

Commit

Permalink
Create full_duplex.ino
Browse files Browse the repository at this point in the history
  • Loading branch information
PowerBroker2 authored Dec 20, 2019
1 parent cd14124 commit 53d09f9
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions examples/full_duplex/full_duplex.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include "SerialTransfer.h"

SerialTransfer myTransfer;

void setup()
{
Serial.begin(115200);
Serial1.begin(115200);
myTransfer.begin(Serial1);
}

void loop()
{
float myFloat = 100.5;

myTransfer.txBuff[0] = 'h';
myTransfer.txBuff[1] = 'i';
myTransfer.txBuff[2] = '\n';

myTransfer.sendData(3);
delay(100);

while(!myTransfer.available())
{
if(myTransfer.status < 0)
{
Serial.print("ERROR: ");
Serial.println(myTransfer.status);
}
}

Serial.println("New Data");
for(byte i = 0; i < myTransfer.bytesRead; i++)
Serial.write(myTransfer.rxBuff[i]);
Serial.println();
}

0 comments on commit 53d09f9

Please sign in to comment.