25 lines
783 B
C++
Executable File
25 lines
783 B
C++
Executable File
#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();
|
|
}
|
|
}
|