From b21e188c0510ce19277dbdf6ea854f161a8bd3b3 Mon Sep 17 00:00:00 2001 From: Marcus Date: Sun, 13 Aug 2023 03:58:03 +0200 Subject: [PATCH] add Mode Selector on D7. HIGH is two Controller Mode. Delay set to 5 se --- arduino-max485-epever-json-serial.ino | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/arduino-max485-epever-json-serial.ino b/arduino-max485-epever-json-serial.ino index 37328b6..d255a4e 100644 --- a/arduino-max485-epever-json-serial.ino +++ b/arduino-max485-epever-json-serial.ino @@ -64,6 +64,9 @@ TRACER => MAX485 blue => B green => A + + Put a 10K Resistor from D7 to GND. + To enable two Controller Mode, add a Jumper from 5V to D7. */ //#include // empty library for potential future use @@ -74,7 +77,8 @@ // when having two solar controllers, set it to true, otherwise to false // it is important to set it to false when only having one solar controller // to avoid waiting for the timeout of the second controller -bool twoController = true; +bool twoController = false; +int twoControllerBoolPin = 7; SoftwareSerial myserial(10, 11); // RX, TX SoftwareSerial myserial2(8, 9); // RX, TX @@ -141,6 +145,16 @@ void postTransmission2() void setup() { + + // set twoControllerBoolPin to Input + pinMode(twoControllerBoolPin, INPUT); + + // check if twoController Mode is set (HIGH) + if(digitalRead(twoControllerBoolPin) == HIGH ) { + twoController = true; + } + + pinMode(MAX485_RE_NEG, OUTPUT); pinMode(MAX485_DE, OUTPUT); // Init in receive mode @@ -234,7 +248,7 @@ void loop() //Serial.println(); //Serial.write( '\r' ); // Carriage Return Serial.write( '\n' ); // EOL - delay(1000); + delay(5000); }