/* ShiftRegister74HC595 - Bibliothèque pour un contrôle simplifié des registres à décalage 74HC595. Développé et maintenu par Timo Denk et ses contributeurs, depuis novembre 2014. Des informations supplémentaires sont disponibles sur https://timodenk.com/blog/shift-register-arduino-library/ Lâché dans le domaine public. */ #include // create a global shift register object // parameters: (data pin, clock pin, latch pin) ShiftRegister74HC595<1> sr(0, 1, 2); void setup() { } void loop() { // setting all pins at the same time to either HIGH or LOW sr.setAllHigh(); // set all pins HIGH delay(500); sr.setAllLow(); // set all pins LOW delay(500); // setting single pins for (int i = 0; i < 8; i++) { sr.set(i, HIGH); // set single pin HIGH delay(250); } // set all pins at once uint8_t pinValues[] = { B10101010 }; sr.setAll(pinValues); delay(1000); // read pin (zero based, i.e. 6th pin) uint8_t stateOfPin5 = sr.get(5); sr.set(6, stateOfPin5); // set pins without immediate update sr.setNoUpdate(0, HIGH); sr.setNoUpdate(1, LOW); // at this point of time, pin 0 and 1 did not change yet sr.updateRegisters(); // update the pins to the set values }