06
- August
2020
Posted By : Dave Hartburn
Particle hardware: PCF8574

See details about the PCF8574 board in the Micro:bit notes.

Write example, sets all inputs high then low:

#include <Wire.h>

int PCF_ADDR = 0x20;

void pcfSend(int a, unsigned int d) {
    Wire.beginTransmission(a);
    Wire.write(d);
    Wire.endTransmission();
    delay(100);
}
    
void setup() {
    Wire.begin();
}

void loop() {
    pcfSend(PCF_ADDR, 0xFF);
    delay(1000);
    pcfSend(PCF_ADDR, 0x00);
    delay(1000);
}

Leave a Reply