Ciao a tutti,
sto cercando di alzare un uscita specifica attraverso lo shift register e condizione di if.
Non riesco pero' ad alzare e abbassare l'uscita in base alla condizione di if.
ma cosa cavolo ho toppato?
Spero questa volta che almeno l'indentazione sia meglio che le altre volte...
#include <ShiftRegister74HC595.h>
int pulsante1 = 19; //A5
int pulsante2 = 18; //A4
ShiftRegister74HC595 sr (2, 13, 2, 3);
void setup() {
sr.setAllHigh(); // sets all pins either on high ...
// sr.setAllLow();// ... or low
pinMode (pulsante1, INPUT);
pinMode (pulsante2, INPUT);
}
void loop() {
if (digitalRead(pulsante1 ) == HIGH) {
sr.set(0, HIGH); // sets a specific pin of your shift register on high // equivalent to sr.set(pin, 1);
}
else {
sr.set(0, LOW);
}
// sr.setAllHigh();// sets all pins either on high ...
// sr.setAllLow();// ... or low
// sets all pins at once (pin 0 low, pin 1 high, ...)
// uint8_t pinValues[] = { B10101010 };// sets all pins at once (pin 0 low, pin 1 high, ... B76543210)
// sr.setAll(pinValues); // B10101010
// set multiple pins at once when using two shift registers in series
// uint8_t pinValues[] = { B00011000, B10101010 }; //B76543210, B76543210)
// sr.setAll(pinValues); //B10101010, B10101010
// sr.updateRegisters(); // update the pins to the set values
}