- This topic has 3 replies, 1 voice, and was last updated 5 years, 3 months ago by .
- You must be logged in to reply to this topic.
Home › Forums › The libraries hosted on the site › PCF8574 i2c digital I/O expander › Add functionality to check if device is connected properly.
Tagged: Enhancement
Hey Renzo,
Thank you for this very usefull library! I am using it for a current project, however I found that I am not able to see if the device is connected properly.
As a solution to this, I would like to suggest that the return value of “_write.endtransmission()” is used to see if the I2C transmission was succesfull.
For example, a “status” parameter could be added to the PCF8574 class, which indicates that the latest transmission has failed. It is also possible to return the result of “_write.endtransmission()” in the .begin() function, instead of using a void function.
Feel free to do with this suggestion as you please.
Best, Michiel
Hi Michiel
now It’s possible to check the status with
if (pcf8574.begin()){
Serial.println("pcf8574 started!");
}else{
Serial.println("pcf8574 not started!");
}
or
if (pcf8574.digitalWrite(P7, startVal)){
Serial.println("Write ok");
}else{
Serial.println("Write not ok");
}
It’s also possible to get last writeStatus with
uint8_t getTransmissionStatusCode() const {
return transmissionStatus;
}
bool isLastTransmissionSuccess(){
return transmissionStatus==0;
}
Bye Renzo
Any tips on how to check if digitalReadAll() is successful?
Br/Mob
I think there Is no way tuo check that the buffer retrieved Is correct.
I only check if there are data to buffer but It isn’t a solution maybe.
Bye Renzo
More
Just like a well-organized workbench, this website uses cookies to function properly and efficiently.
🛠️ The Essentials (Necessary): Some cookies are categorized as necessary and are stored on your browser because they are critical for the basic working of the site.
📊 The Analytics (Third-party): We also use third-party cookies to help us analyze traffic and understand which projects you like the most. These are stored only if you give us the green light.
You can choose to opt-out, but keep in mind that disabling them might make the site experience a bit less "smooth".
| Cookie | Duration | Description |
|---|---|---|
| cookielawinfo-checkbox-analytics | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics". |
| cookielawinfo-checkbox-functional | 11 months | The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional". |
| cookielawinfo-checkbox-necessary | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary". |
| cookielawinfo-checkbox-others | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other. |
| cookielawinfo-checkbox-performance | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance". |
| viewed_cookie_policy | 11 months | The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data. |
