TTL Support
This commit is contained in:
parent
a7a897e66b
commit
b30ba73eea
4 changed files with 15 additions and 4 deletions
3
README
3
README
|
@ -10,7 +10,8 @@ This project is designed to work over serial with an external computer that deci
|
|||
-DRELAY1 : Enable the First Relay
|
||||
-RELAY1_REVERSED : If the open and closed state of relay one are reversed.
|
||||
-DRELAY2 : Not implemented yet
|
||||
|
||||
-DUSB_SERIAL : For outputing serial over USB
|
||||
-DTTL_SERIAL : For outputing serial on RX0/TX0
|
||||
|
||||
# Important Notes:
|
||||
* None
|
|
@ -16,6 +16,8 @@
|
|||
#define RELAY1_PIN 32
|
||||
#define RELAY2_PIN 33
|
||||
#define RELAY_DELAY 3000
|
||||
#define RX_PIN 3
|
||||
#define TX_PIN 1
|
||||
#endif
|
||||
|
||||
#ifdef BOARD2
|
||||
|
@ -27,6 +29,8 @@
|
|||
#define DATA1_PIN 27
|
||||
#define RELAY1_PIN 13
|
||||
#define RELAY_DELAY 3000
|
||||
#define RX_PIN 3
|
||||
#define TX_PIN 1
|
||||
#endif
|
||||
|
||||
void controlRelay();
|
||||
|
|
|
@ -19,7 +19,7 @@ build_flags = -DBOARD1 -DRELAY1
|
|||
platform = espressif32
|
||||
framework = arduino
|
||||
board = nodemcu-32s
|
||||
build_flags = -DBOARD2 -DBUZZER -DRELAY1
|
||||
build_flags = -DBOARD2 -DBUZZER -DRELAY1 -DUSB_SERIAL
|
||||
|
||||
|
||||
|
||||
|
|
10
src/main.cpp
10
src/main.cpp
|
@ -101,7 +101,13 @@ void handleData1Interrupt() {
|
|||
|
||||
void setup() {
|
||||
|
||||
Serial.begin(9600);
|
||||
#ifdef USB_SERIAL
|
||||
Serial.begin(9600);
|
||||
#endif
|
||||
#ifdef TTL_SERIAL
|
||||
Serial1.begin(9600, SERIAL_8N1, TX_PIN, RX_PIN);
|
||||
#endif
|
||||
|
||||
settings.loadFromEEPROM();
|
||||
|
||||
pinMode(DATA0_PIN, INPUT_PULLUP);
|
||||
|
@ -209,7 +215,7 @@ void loop() {
|
|||
commandEnableDoor();
|
||||
} else if (command.equals("disable")) {
|
||||
commandDisableDoor();
|
||||
}else if (command.equals("disabled_status")) {
|
||||
} else if (command.equals("disabled_status")) {
|
||||
commandDisabledState();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue