Hi,
I found me error why the PCF8574 is dead.
I used A2 and A3 as digital outputs A2 high (+5V) and A3 low (GND) to deliver the 5V to the I2C boards and de relay module but the current was to high. .
Now I'm using an external 12V to 5V power regulator connected to Vin
Below you can found me test code that i already have
The Timelord lib will be used to calculated the sunrise and sunset time
the Time and TimeAlarms lib will be used to schedule timed actions (recalculate everyday the sunset/rise time turn on/off the light and set max temp and humidity
...
//#include <TimeLord.h>
//#include <Time.h>
//#include <TimeAlarms.h>
#include <Wire.h>
//#include <DS1307RTC.h>
//#include <SoftPWM.h>
//#include <Adafruit_MCP23017.h>
//#include <Adafruit_RGBLCDShield.h>
// Pin definitions
const byte
I2C_SDA_PIN = A4,
I2C_SCL_PIN = A5;
//exo-terra dual top parameters
#define DUALTOP_ADDR 0x21 //PCF8574 Halogen on B0, TL on B1
byte dualtop_byte;
boolean TL, Halogen;
// Set pin modes
void setup()
{
Wire.begin();
Serial.begin(9600);
}
void update_dualtop() // calcualte byte that is send to the PCF8574 in the dualtop
{
if (TL == true)
{
dualtop_byte = 255 - 0x02;
}
if (Halogen == true)
{
dualtop_byte = 255 - 0x01;
}
if (Halogen == true && TL == true)
{
dualtop_byte = 255 - 0x03;
}
if (Halogen == false && TL == false)
{
dualtop_byte = 255 - 0x00;
}
//else dualtop_byte = 0x00;
Wire.beginTransmission(DUALTOP_ADDR);
Wire.write(dualtop_byte);
Wire.endTransmission();
}
void loop ()
{
Serial.println("TL");
TL = true;
Halogen = false;
update_dualtop();
Serial.println(dualtop_byte,BIN);
delay (1000);
Serial.println("Halogen");
TL = false;
Halogen = true;
update_dualtop();
Serial.println(dualtop_byte,BIN);
delay (1000);
Serial.println("Halogen + TL");
TL = true;
Halogen = true;
update_dualtop();
Serial.println(dualtop_byte,BIN);
delay (1000);
Serial.println("off");
TL = false;
Halogen = false;
update_dualtop();
Serial.println(dualtop_byte,BIN);
delay (1000);
}
Kind regards
Koen