Bonsoir,
J'essaye en vain d'utiliser les librairies PCF8574 et PCF8575.
Mon problème ne se situe pas au niveau des entrées ou des sorties mais dans l'utilisation des interruptions.
Pour mon test j'utilise les exemples fournis des les fichiers bibliothèques (le non fonctionnement est identique avec le PCF8574 ou le PCF8575).
Quelqu'un a-t-il fait des essais concluants avec les interruptions de ces librairies ?
J'essaye de reproduire la démo de Skywodd : [arduino] I2C 16 I/O – PCF8575 | Skyduino - Le DIY à la française
Lorsque je connecte la sortie INT du PCF8575 à la pin 8 de ma UNO R3 (même phénomène avec Duomilanovo) les clignotement deviennent erratiques. Si la pin8 n'est pas relié le comportement est conforme au programme hormis, bien sur, la gestion des interruptions.
Voici le code utilisé :
#include <PCF8575.h> // Required for ... all
#include <Wire.h> // Required for I2C communication
PCF8575 expander; // Create object from PCF8575 class
void setup(){
Serial.begin(9600); // Setup serial for read echo
expander.pinMode(0,OUTPUT); // Setup pin D0 as output
expander.pinMode(15,OUTPUT); // Setup pin D1 as output
expander.pinMode(3,INPUT); // Setup pin D3 as input
expander.begin(0x20);
expander.pullUp(3); // Enable pull-up resistor on pin D3 (button)
expander.enableInterrupt(8,ISRgateway); // Enable interrupt by attach interruption handler to arduino pin D8 and save ISRgateway as callback function
expander.attachInterrupt(3,ISRexpander,FALLING); // Attach an virtual interrupt on the pin D3 (button) of the PCF8575
}
void ISRgateway(){
expander.checkForInterrupt(); // ISRgateway act as an wrapper for attachInterrupt from namespace PCF8575:: to the global scope
}
void ISRexpander(){ // ISRexpander will be call when the PCF8574 pin D3 will goes from high to low
expander.blink(15,5,200); // Blink the led on pin D0 on PCF8574 (to test TWI into an ISR called function /debug)
}
void loop(){
expander.blink(0,5,200);
delay(1000);
} // Loop forever
Si quelqu' un a une piste d'où pourrait provenir ce dysfonctionnement, je suis preneur
Merci pour votre aide