so if I had a mind left to lose, I would have lost it by now.
I can not get the pcf8574 to work on anything. right now im using the seeeduino Xiao. I have also tried a pro micro, and I have a nRF52832 that I plan on using.
None of them want to work for me.
I have found numerous tutorials on line using one of two libraries. xreef PCF8574 Library
If I2C does not work out of the box
the first thing to use is a I2C-scanner
// --------------------------------------
// i2c_scanner
//
// Version 1
// This program (or code that looks like it)
// can be found in many places.
// For example on the Arduino.cc forum.
// The original author is not know.
// Version 2, Juni 2012, Using Arduino 1.0.1
// Adapted to be as simple as possible by Arduino.cc user Krodal
// Version 3, Feb 26 2013
// V3 by louarnold
// Version 4, March 3, 2013, Using Arduino 1.0.3
// by Arduino.cc user Krodal.
// Changes by louarnold removed.
// Scanning addresses changed from 0...127 to 1...119,
// according to the i2c scanner by Nick Gammon
// https://www.gammon.com.au/forum/?id=10896
// Version 5, March 28, 2013
// As version 4, but address scans now to 127.
// A sensor seems to use address 120.
// Version 6, November 27, 2015.
// Added waiting for the Leonardo serial communication.
//
//
// This sketch tests the standard 7-bit addresses
// Devices with higher bit address might not be seen properly.
//
#include <Wire.h>
void setup() {
Wire.begin();
Serial.begin(9600);
while (!Serial); // Leonardo: wait for serial monitor
Serial.println("\nI2C Scanner");
}
void loop() {
int nDevices = 0;
Serial.println("Scanning...");
for (byte address = 1; address < 127; ++address) {
// The i2c_scanner uses the return value of
// the Write.endTransmisstion to see if
// a device did acknowledge to the address.
Wire.beginTransmission(address);
byte error = Wire.endTransmission();
if (error == 0) {
Serial.print("I2C device found at address 0x");
if (address < 16) {
Serial.print("0");
}
Serial.print(address, HEX);
Serial.println(" !");
++nDevices;
} else if (error == 4) {
Serial.print("Unknown error at address 0x");
if (address < 16) {
Serial.print("0");
}
Serial.println(address, HEX);
}
}
if (nDevices == 0) {
Serial.println("No I2C devices found\n");
} else {
Serial.println("done\n");
}
delay(2000); // Wait 5 seconds for next scan
}
Yes I did do that. Just ran it again for sanity sake too.
I2C device found at address 0x20 !
done
Scanning...
I2C device found at address 0x20 !
done
Scanning...
I2C device found at address 0x20 !
done
Scanning...
I2C device found at address 0x20 !
done
What exact type of PCF8574-device/board are you using?
plain chip or some kind of board?
With a plain chip are you using pullup-resistors?
Does the board have pullup-resistors?
means if you really use a ESP8266 or a ESP32-board the constant is defined and in case of that
it is using this variant. But with any onther boards it is using it not
What you could have done right with the first post and should do now is posting a
easy-to-see-connections-picture
easy-to-see-connections-picture means your wiring must be clearly recognisable by just seeing the picture. Remember other users are not sitting next to you to have a look at the real thing they only have the picture.
Best option to do this is taking the picture from vertical above
or to add Text after taking the picture.
and
no
fritzing-pseudo-schematic!
a handdrawn schematic is 10 times better than a fritzing-picture
Fritzing is wiring by "looks-like" which is the opposite of wiring by understanding it really
If you don't have a 24 MHz 8 channel logic analyser this is the right time to buy one.
Price $10. Such a device can visualise the signals of IO-pins at high time-resoultion
It is used with a software sigrok pulseview which can even analyse the data that is sended /received
A handy tool. I have a "real" logic analyser, but I got one of these just to give it a spin. Besides coming with a defective cable which I quickly discovered through careful tests kept me tearing hair for quite some time, it works to spec.
I think it would work for most of what I ever did with the real one.
Pulseview works OK, so does the Saleae software. If you are new to it, a bit of a learning curve but not too bad. The things you will see!
Anyway, are you powering everything at 3.3 volts? I don't think the I2C bus wuold work if the processor was at 3.3 and the device at 5 volts, but just in case I ask.
Great news! I got the PCF8574 working on the Pro Micro. Im not a complete idiot!
Thanks to the logic analyzer! I found that using Wire.h the seeeduino will scan, but using the library, nothing happens. So I am thinking that the library is not compatible with the Seeeduino.
This means the library wire.h can be used with a seeeduino XIAO
This is not snapchat or WhatsApp with smalltalk
this is the arduino-user-forum
If somebody shall help you you have to provide more info
post a picture of your actual wiring
post your actual code
with this method
There is an automatic function for doing this in the Arduino-IDE
just three steps
press Ctrl-T for autoformatting your code
do a rightclick with the mouse and choose "copy for forum"