NEED HELP - "if" "else" tft.println()

Hi All,
Equipment: Elegoo Mega2560
KUMAN ili9486 Touchscreen
1- float switch

How would I write the code to display a message on my touchscreen when my float switch closes?

Example: Water gets to high, float switch closes (Makes), then Display "High Water" on my touchscreen? Else "Normal".

Sump alarm in my house...Flooding Sucks!

Thx

start by

  1. check you can program the Mega, e.g. compile and upload the blink program
  2. connect the float switch and implement and test a program to read it's states, see Arduino digital pins
  3. see if can find a library which supports the toutchscreen - if so instal it and run the examples

you can then start starting thinking about implementing the code to read the state of the float switch and display the result on the toutchscreen

2 Likes

How do I clear a print line?

Did you read the request?

Most devices have a clear command - docs on your device should tell.
Alternatively you can print a row of spaces over last message and print new.
reading a switch is easy: digitalRead(mySwitch);
Put that in an IF statement and then print or clear as appropriate.
Use pinMode(mySwitch, INPUT_PULLUP); to initialize.
Wire switch between the input pin and NO to gnd. It will read as LOW when active in code.

show us what you have done so far?
if you want someone to implement the project for you post in Jobs and Paid Consultancy

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.