OpenSprinkler Forums OpenSprinkler Unified Firmware Change Firmware to control stations directly via GPIO pins (relays)

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #69430

    Tobasco
    Participant

    Hi,
    after my beloved OS Bee died and I couldn’t fix it, I decide to set up a new one based on an “ESP8266 WIFI 4 Channels Relay Module AC/DC ESP-12F Development Board”.

    The flashing, WiFi connection and OLED Display works already, now I want to change the firmware to control the 4 relays via the GPIO pins

    1. GPIO16 (D0)
    2. GPIO14 (D5)
    3. GPIO12 (D6)
    4. GPIO13 (D7)

    May you give me a hint, which part of the code I have to change so that Station 1 to 4 is linked to this GPIO pins?

    salute
    Thomas

    #69440

    Tobasco
    Participant

    Hi,
    I solved my problem by replacing apply_all_station_bits() with custom code to control the GPIO pins for the relays:

    void OpenSprinkler::apply_all_station_bits() {
      const uint8_t stationGPIO[] = {16, 14, 12, 13};
      for (uint8_t i = 0; i < 4; i++) {
        pinMode(stationGPIO[i], OUTPUT);
        digitalWrite(stationGPIO[i], station_bits[0] & 1 << i ? HIGH : LOW);
      }
    }

    salute
    Thomas

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

OpenSprinkler Forums OpenSprinkler Unified Firmware Change Firmware to control stations directly via GPIO pins (relays)