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
|
-DRELAY1 : Enable the First Relay
|
||||||
-RELAY1_REVERSED : If the open and closed state of relay one are reversed.
|
-RELAY1_REVERSED : If the open and closed state of relay one are reversed.
|
||||||
-DRELAY2 : Not implemented yet
|
-DRELAY2 : Not implemented yet
|
||||||
|
-DUSB_SERIAL : For outputing serial over USB
|
||||||
|
-DTTL_SERIAL : For outputing serial on RX0/TX0
|
||||||
|
|
||||||
# Important Notes:
|
# Important Notes:
|
||||||
* None
|
* None
|
|
@ -16,6 +16,8 @@
|
||||||
#define RELAY1_PIN 32
|
#define RELAY1_PIN 32
|
||||||
#define RELAY2_PIN 33
|
#define RELAY2_PIN 33
|
||||||
#define RELAY_DELAY 3000
|
#define RELAY_DELAY 3000
|
||||||
|
#define RX_PIN 3
|
||||||
|
#define TX_PIN 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef BOARD2
|
#ifdef BOARD2
|
||||||
|
@ -27,6 +29,8 @@
|
||||||
#define DATA1_PIN 27
|
#define DATA1_PIN 27
|
||||||
#define RELAY1_PIN 13
|
#define RELAY1_PIN 13
|
||||||
#define RELAY_DELAY 3000
|
#define RELAY_DELAY 3000
|
||||||
|
#define RX_PIN 3
|
||||||
|
#define TX_PIN 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void controlRelay();
|
void controlRelay();
|
||||||
|
|
|
@ -19,7 +19,7 @@ build_flags = -DBOARD1 -DRELAY1
|
||||||
platform = espressif32
|
platform = espressif32
|
||||||
framework = arduino
|
framework = arduino
|
||||||
board = nodemcu-32s
|
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() {
|
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();
|
settings.loadFromEEPROM();
|
||||||
|
|
||||||
pinMode(DATA0_PIN, INPUT_PULLUP);
|
pinMode(DATA0_PIN, INPUT_PULLUP);
|
||||||
|
@ -209,7 +215,7 @@ void loop() {
|
||||||
commandEnableDoor();
|
commandEnableDoor();
|
||||||
} else if (command.equals("disable")) {
|
} else if (command.equals("disable")) {
|
||||||
commandDisableDoor();
|
commandDisableDoor();
|
||||||
}else if (command.equals("disabled_status")) {
|
} else if (command.equals("disabled_status")) {
|
||||||
commandDisabledState();
|
commandDisabledState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue