Added debug config
This commit is contained in:
23
src/main.cpp
23
src/main.cpp
@@ -103,11 +103,12 @@ void setup()
|
||||
|
||||
void loop()
|
||||
{
|
||||
const uint8_t devAddress(0xAA);
|
||||
const uint8_t tempBoardAddr(0xAA);
|
||||
const uint8_t relayBoardAddr(0x01);
|
||||
const uint8_t baseRegister(0x00);
|
||||
LOG_INFO("Looop");
|
||||
std::vector<uint16_t> results;
|
||||
bool success = bus.readHoldingRegisters(devAddress, baseRegister, 8, results);
|
||||
bool success = bus.readHoldingRegisters(tempBoardAddr, baseRegister, 8, results);
|
||||
if (success)
|
||||
{
|
||||
for (auto i(0); i < results.size(); i++)
|
||||
@@ -116,19 +117,19 @@ void loop()
|
||||
}
|
||||
results.clear();
|
||||
}
|
||||
|
||||
delay(100);
|
||||
for (auto i(0); i < 8; i++)
|
||||
{
|
||||
LOG_DEBUG("\nCHANNEL ", i);
|
||||
LOG_DEBUG("\n\nCHANNEL ", i);
|
||||
std::vector<bool> values;
|
||||
bus.writeCoil(0x01, (uint8_t)i, true);
|
||||
delay(500);
|
||||
bus.readCoils(0x01,0x00,8, values);
|
||||
for (auto v: values ) {
|
||||
LOG_DEBUG("Coil", i, v ? "True" : "False");
|
||||
bus.writeCoil(relayBoardAddr, (uint8_t)i, true);
|
||||
bus.readCoils(relayBoardAddr,0x00,8, values);
|
||||
for (auto j(0); j < values.size(); j++) {
|
||||
LOG_DEBUG("Coil", j, values.at(j) ? "True" : "False");
|
||||
}
|
||||
bus.writeCoil(0x01, (uint8_t)i, false);
|
||||
delay(500);
|
||||
delay(1000);
|
||||
bus.writeCoil(relayBoardAddr, (uint8_t)i, false);
|
||||
delay(1000);
|
||||
}
|
||||
delay(5000);
|
||||
}
|
||||
Reference in New Issue
Block a user