OpenSprinkler › Forums › Hardware Questions › Alternative hardware › Reply To: Alternative hardware
loop_1
🙂
ok the parts to change are this:
____________________________________________________________________
void OpenSprinkler::begin() {
// shift register setup
pinMode(PIN_SR_OE, OUTPUT);
// pull shift register OE high to disable output
digitalWrite(PIN_SR_OE, HIGH);
pinMode(PIN_SR_LATCH, OUTPUT);
digitalWrite(PIN_SR_LATCH, HIGH);
pinMode(PIN_SR_CLOCK, OUTPUT);
pinMode(PIN_SR_DATA, Â OUTPUT);
// Reset all stations
clear_all_station_bits();
apply_all_station_bits();
// pull shift register OE low to enable output
digitalWrite(PIN_SR_OE, LOW);
// Rain sensor port set up
pinMode(PIN_RAINSENSOR, INPUT);
____________________________________________________________________
and this:
____________________________________________________________________
// Apply all station bits
// !!! This will activate/deactivate valves !!!
void OpenSprinkler::apply_all_station_bits() {
digitalWrite(PIN_SR_LATCH, LOW);
byte bid, s, sbits;
// Shift out all station bit values
// from the highest bit to the lowest
for(bid=0;bid<=MAX_EXT_BOARDS;bid++) {
if (status.enabled)
sbits = station_bits[MAX_EXT_BOARDS-bid];
else
sbits = 0;
for(s=0;s<8;s++) {
digitalWrite(PIN_SR_CLOCK, LOW);
digitalWrite(PIN_SR_DATA, (sbits & ((byte)1<<(7-s))) ? HIGH : LOW );
digitalWrite(PIN_SR_CLOCK, HIGH);
}
}
digitalWrite(PIN_SR_LATCH, HIGH);
____________________________________________________________________
but i don’t undestand the function of pins PIN_SR_LATCH and PIN_SR_OE that i think to change with my pin outputs that are GPIO 17 (main pump) and GPIO18, GPIO22 and GPIO27 for the three zones. The pins PIN_SR_DATA and PIN_SR_CLOCK are for serial communication with the opensprinkler board, i think…