06-06-2022, 08:33 AM
Hi all,
i am pretty new to ESP32 and programming with Arduion IDE. I have purchased a KC868-A8-V1.4 board and now i wanted to do the Realy programming according to the instruction from your site KC868-A8 programming
Correct type of board is selected NodeMCU-32S and the pins in pins_arduino.h are changed to 4 + 5, PCF8574 library V2.3.1 from Renzo Mischianti is installed.
The problem i am facing is that the PCF8574 throws all the time "error" instead of "OK" and therefore the relays are not working.
In order to test whether the board has a hardware problem, I have also tried once the TASMATO accoring to the video Tasmato KC868-A8, this has worked without any problems. So the hardware is ok.
Do you know what i am doing wrong that the PCF8574 throws the error?
Any help would be appreaciated
Used code:
i am pretty new to ESP32 and programming with Arduion IDE. I have purchased a KC868-A8-V1.4 board and now i wanted to do the Realy programming according to the instruction from your site KC868-A8 programming
Correct type of board is selected NodeMCU-32S and the pins in pins_arduino.h are changed to 4 + 5, PCF8574 library V2.3.1 from Renzo Mischianti is installed.
The problem i am facing is that the PCF8574 throws all the time "error" instead of "OK" and therefore the relays are not working.
In order to test whether the board has a hardware problem, I have also tried once the TASMATO accoring to the video Tasmato KC868-A8, this has worked without any problems. So the hardware is ok.
Do you know what i am doing wrong that the PCF8574 throws the error?
Any help would be appreaciated
Used code:
PHP Code:
/*
Kincony KC868-A8
Relays example
*/
#include "Arduino.h"
#include "PCF8574.h"
#define I2C_RELAYS_ADR 0x24
PCF8574 pcf(I2C_RELAYS_ADR);
void setup() {
Serial.begin(115200);
Serial.println(F("Start Kincony KC868-A8 Relays example…"));
pcf.pinMode(P0, OUTPUT);
pcf.pinMode(P1, OUTPUT);
pcf.pinMode(P2, OUTPUT);
pcf.pinMode(P3, OUTPUT);
pcf.pinMode(P4, OUTPUT);
pcf.pinMode(P5, OUTPUT);
pcf.pinMode(P6, OUTPUT);
pcf.pinMode(P7, OUTPUT);
Serial.print("Init PCF8574… ");
if (pcf.begin()){
Serial.println(F("Ok"));
}else {
Serial.println(F("Error"));}
}
void loop() {
pcf.digitalWrite(P0, HIGH);
Serial.print(F("Relay #")); Serial.print(P0); Serial.println(F(" ON"));
delay(10000);
pcf.digitalWrite(P0, LOW);
Serial.print(F("Relay #")); Serial.print(P0); Serial.println(F(" OFF"));
delay(10000);
}