arduinoi2cparticle-photon

Particle Photon, controlling a PCF8574 via I2C- works on Arduino


I'm trying to read and control some buttons and LEDs on a Bang & Olufsen infrared eye. It uses a pcf8574 microcontroller to control 2 LEDs and 4 buttons. First of all I just want to get the LEDs to blink. I have successfully done that with an Arduino Uno.

But I want to use it with an Particle Photon so I can connected to the internet. Here I have the code that worked on the Arduino:

#include <Wire.h>
#define beolink (B0100000) 

void setup() {
    Wire.begin();
}

void loop() {
    Wire.beginTransmission(beolink);
    Wire.write(0b11111111);
    Wire.endTransmission();
    delay(1000);
    Wire.beginTransmission(beolink);
    Wire.write(0b00111111);
    Wire.endTransmission();
    delay(1000);
} 

I have no errors on the Particle Photon. I have also tried switching cables and tried 5v instead of the 3.3v. I have connected the pins on the Particle Photon to the same as on the Arduino [SCL(D1) & SDA(D0)].


Solution

  • Thanks to this guy: https://community.particle.io/u/scruffr/summary It now works. It was not a problem with the code. Apparently you need 2 pull-up resistors on the I2C pins on a Particle Photon. thank you