OpenSprinkler › Forums › Hardware Questions › Alternative hardware › Reply To: Alternative hardware
PIN_SR_LATCH and PIN_SR_OE are pins relevant to the shift register. These don’t matter to you. For example, in the begin() function, comment out all lines that have to do with PIN_SR_LATH, _OE, _DATA, and _CLOCK, and instead, replace them with code that initialize your GPIO pins. Say if you are using GPIO18, GPIO22, GPIO27 for zones 1, 2, 3, just write:
which sets GPIO18 as an output pin and initializes it to zero. Similar for the other two pins.
For apply_all_station_bits(), that function reads out the station status, and pushes out the value to shift registers. You can comment out the entire section and replace it with something like:
byte brd_bits = station_bits; // brd_bits stores the status of the first 8 stations, i.e. those on the main controller
digitalWrite(GPIO18, brd_bits & 0x01); // assigns the status of the first station to GPIO18
digitalWrite(GPIO22, (brd_bits >> 1) & 0x01); // second station to GPIO22
digitalWrite(GPIO27, (brd_bits >> 2) & 0x01); // third station to GPIO27