02-02-2025, 10:26 AM
And honestly I thought that was going to work. When wired like that, a NPN sensor appears to behave correctly (i.e. the LED indicator on the sensor lights up when an object is detected, unlike with the PNP sensor that remains permenantly triggered), and the output wire switches from 12V to GND, but it does not get registered as a change in input from a digitalRead of the PCF8574 input.
I was beginning to wonder whether I had somehow damaged the optocoupler or PCF8574, but don't think I have since it still correctly reads an input if I simply attach a short wire from DI to GND.
I was beginning to wonder whether I had somehow damaged the optocoupler or PCF8574, but don't think I have since it still correctly reads an input if I simply attach a short wire from DI to GND.