/* Lecture_2_pcf8574_bit_oar_bit avec librairie: "https://github.com/RobTillaart/PCF8574" */ #include <PCF8574.h> PCF8574 PCF_38 ( 0x38 ); // selon adresse pcf8574 n°1 PCF8574 PCF_3c ( 0x3c ); // selon adresse pcf8574 n°2 const byte Pcfbp1 = 0; const byte Pcfbp2 = 1; const byte Pcfbp3 = 2; const byte Pcfbp4 = 3; const byte Pcfbp5 = 4; const byte Pcfbp6 = 5; const byte Pcfbp7 = 6; const byte Pcfbp8 = 7; const byte Pcfsw1 = 0; const byte Pcfsw2 = 1; const byte Pcfsw3 = 2; const byte Pcfsw4 = 3; const byte Pcfsw5 = 4; const byte Pcfsw6 = 5; const byte Pcfsw7 = 6; const byte Pcfsw8 = 7; void setup() { Serial.begin(115200); PCF_38.begin(); PCF_3c.begin(); } void loop() { Serial.print("sw1 = " ); Serial.println(PCF_38.readButton(Pcfsw1)); Serial.print("sw2 = " ); Serial.println(PCF_38.readButton(Pcfsw2)); Serial.print("sw3 = " ); Serial.println(PCF_38.readButton(Pcfsw3)); Serial.print("sw4 = " ); Serial.println(PCF_38.readButton(Pcfsw4)); Serial.print("sw5 = " ); Serial.println(PCF_38.readButton(Pcfsw5)); Serial.print("sw6 = " ); Serial.println(PCF_38.readButton(Pcfsw6)); Serial.print("sw7 = " ); Serial.println(PCF_38.readButton(Pcfsw7)); Serial.print("sw8 = " ); Serial.println(PCF_38.readButton(Pcfsw8)); Serial.print("bp1 = " ); Serial.println(PCF_3c.readButton(Pcfbp1)); Serial.print("bp2 = " ); Serial.println(PCF_3c.readButton(Pcfbp2)); Serial.print("bp3 = " ); Serial.println(PCF_3c.readButton(Pcfbp3)); Serial.print("bp4 = " ); Serial.println(PCF_3c.readButton(Pcfbp4)); Serial.print("bp5 = " ); Serial.println(PCF_3c.readButton(Pcfbp5)); Serial.print("bp6 = " ); Serial.println(PCF_3c.readButton(Pcfbp6)); Serial.print("bp7 = " ); Serial.println(PCF_3c.readButton(Pcfbp7)); Serial.print("bp8 = " ); Serial.println(PCF_3c.readButton(Pcfbp8)); delay(1000); } |