add Mode Selector on D7. HIGH is two Controller Mode. Delay set to 5 se

This commit is contained in:
Marcus 2023-08-13 03:58:03 +02:00
parent edd4721dde
commit b21e188c05

View file

@ -64,6 +64,9 @@
TRACER => MAX485 TRACER => MAX485
blue => B blue => B
green => A green => A
Put a 10K Resistor from D7 to GND.
To enable two Controller Mode, add a Jumper from 5V to D7.
*/ */
//#include <TracerRegisters.h> // empty library for potential future use //#include <TracerRegisters.h> // empty library for potential future use
@ -74,7 +77,8 @@
// when having two solar controllers, set it to true, otherwise to false // 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 // it is important to set it to false when only having one solar controller
// to avoid waiting for the timeout of the second 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 myserial(10, 11); // RX, TX
SoftwareSerial myserial2(8, 9); // RX, TX SoftwareSerial myserial2(8, 9); // RX, TX
@ -141,6 +145,16 @@ void postTransmission2()
void setup() 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_RE_NEG, OUTPUT);
pinMode(MAX485_DE, OUTPUT); pinMode(MAX485_DE, OUTPUT);
// Init in receive mode // Init in receive mode
@ -234,7 +248,7 @@ void loop()
//Serial.println(); //Serial.println();
//Serial.write( '\r' ); // Carriage Return //Serial.write( '\r' ); // Carriage Return
Serial.write( '\n' ); // EOL Serial.write( '\n' ); // EOL
delay(1000); delay(5000);
} }