#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
#define TFT_DC 2
#define TFT_CS 3
volatile uint32_t count = 0; // Holds the count of interrupts
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
void incrementCount() {
count++;
tft.setCursor(20, 120);
tft.setTextColor(ILI9341_RED);
tft.setTextSize(2);
tft.println("Water level STM32");
tft.setCursor(24, 180);
tft.setTextColor(ILI9341_GREEN);
tft.setTextSize(2);
tft.println("Power out enable");
}
void setup() {
device_init();
Serial.begin(115200);
Serial.println(".");
pinMode(D4, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(D4), incrementCount, RISING);
tft.begin();
tft.setCursor(20, 120);
tft.setTextColor(ILI9341_RED);
tft.setTextSize(2);
tft.println("Water level STM32");
tft.setCursor(24, 160);
tft.setTextColor(ILI9341_GREEN);
tft.setTextSize(2);
tft.println("Water level = " + get.waterlevel());
}
void loop() { delay(10);
Serial.println(count);
}