is that right, we're working on the same time on the very same chip?
Apparently so, if I'd have known what you were doing, I wouldn't have started on this....
And I've, to admit you did the better Job, went the extra mile to implement all features smiley
Thanks a lot!
how do you enter the command mode exactly (within that 3/10ms)?
I have been wrestling with command mode for a couple of weeks, because I didn't know the voltage on the 3.3V pin on the arduino isn't cut when you reset the arduino (or isn't cut long enough). But then finally it hit me... So I just put a 3.3V voltage regulator on a digital pin to supply the chip (the datasheet says it can handle 5V, but I didn't want to fry the chip, so...).
So: digitalWrite(powerPin, HIGH); enables the chip
And: digitalWrite(powerPin, LOW); disables it
If you want to cycle the power do something like this:
// HIH is enabled now, so let's cycle the power:
delay(1); // this is the important part: give the chip the time to notice the power has been cut
I hope this answers your question because I've got no idea what a PCF8591 is or what role an A/D convertor could play here.
If you have any improvements to the code or anything... you're always welcome.