31 lines
488 B
Arduino
31 lines
488 B
Arduino
|
#include <SoftwareSerial.h>
|
||
|
|
||
|
/**
|
||
|
* CONSTANTS
|
||
|
**/
|
||
|
|
||
|
#define rSignal 7
|
||
|
#define tSignal 8
|
||
|
|
||
|
const int serialDelay = 5;
|
||
|
|
||
|
SoftwareSerial softSerial (rSignal, tSignal);
|
||
|
|
||
|
volatile char cmdChar = 'z';
|
||
|
|
||
|
void setup() {
|
||
|
Serial.begin(57600);
|
||
|
Serial.flush();
|
||
|
Serial.setTimeout(serialDelay);
|
||
|
|
||
|
softSerial.begin(9600);
|
||
|
softSerial.flush();
|
||
|
softSerial.setTimeout(serialDelay);
|
||
|
}
|
||
|
|
||
|
void loop () {
|
||
|
if (Serial.available()) {
|
||
|
cmdChar = (char)Serial.read();
|
||
|
softSerial.write(cmdChar);
|
||
|
}
|
||
|
}
|