Good day.
Been baffled on this silly question perhaps as i cannot find any info on this issue or functionality for the inputs/outputs.
My big question today would be for the original TTGO-T display getting pins 32, 38 and 39 to work as an output.
As i have my code now, the TFT is working and showing green screen, detects when a button was pressed but not pulling pin 38 LOW
I tried various ways to to set pin 38 low even tried to test the input button with basic sketches for input/output but same similar results.
My code:
#include <Button2.h>
#include <Hardware.h>
#include <Adafruit_GFX.h>
#include <Adafruit_ST7789.h>
#include <SPI.h>
#define TFT_MOSI 19
#define TFT_SCLK 18
#define TFT_CS 5
#define TFT_DC 16
#define TFT_RST 23
#define TFT_BL 4
uint8_t Button = 36;
uint8_t Pump = 38;
// tried: const int Pump = 38;
byte currentButtonState;
Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST);
void setup() {
Serial.begin(115200);
pinMode(TFT_BL, OUTPUT);
digitalWrite(TFT_BL, HIGH);
tft.init(135, 240);
tft.fillScreen(ST77XX_GREEN);
pinMode(Button, INPUT_PULLUP);
pinMode(Pump, OUTPUT);
digitalWrite(Pump, HIGH);
}
void loop() {
currentButtonState = digitalRead(Button);
if (currentButtonState == LOW) {
digitalWrite(Pump, LOW);
Serial.println("Relay Switched On");
delay(5000);
digitalWrite(Pump, HIGH);
Serial.println("Relay Switched Off");
}
}
On the serial side looping every 5 seconds: E (667770) gpio: gpio_set_level(226): GPIO output gpio_num error
Relay Switched Off
E (667770) gpio: gpio_set_level(226): GPIO output gpio_num error
Relay Switched On
For the genuises out there to give me some pointers or code changes will be much appreciated.