first commit
This commit is contained in:
24
DigiSerial/DigiSerial.ino
Executable file
24
DigiSerial/DigiSerial.ino
Executable file
@@ -0,0 +1,24 @@
|
||||
#include <TinyPinChange.h>
|
||||
#include <SoftSerial.h>
|
||||
|
||||
#define DEBUG_TX_RX_PIN 2 //Adjust here your Tx/Rx debug pin
|
||||
|
||||
SoftSerial MyDbgSerial(DEBUG_TX_RX_PIN, DEBUG_TX_RX_PIN, true); //true allows to connect to a regular RS232 without RS232 line driver
|
||||
|
||||
void setup()
|
||||
{
|
||||
MyDbgSerial.begin(38400); //After MyDbgSerial.begin(), the serial port is in rxMode by default
|
||||
MyDbgSerial.txMode(); //Before sending a message, switch to txMode
|
||||
MyDbgSerial.println(F("\nDebug enabled"));
|
||||
MyDbgSerial.rxMode(); //switch to rxMode to be ready to receive some commands
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
if(MyDbgSerial.available())
|
||||
{
|
||||
MyDbgSerial.txMode();
|
||||
MyDbgSerial.print(F("\nReceived: "));MyDbgSerial.write(MyDbgSerial.read());MyDbgSerial.print(F("\n"));
|
||||
MyDbgSerial.rxMode();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user