Push a Button to Display Text on a LCD ?

:astonished: :roll_eyes: :roll_eyes: How do i make this work if i have a Push Button on a analog port and push it and want a message to Display Text on a LCD ?
or using a pot from 0 to 100 % at 50% turn on a message on the lcd and if the pot gose below 50% the message turns off.?
im new to all this so any help would be great :open_mouth:

Have you looked into the lcd.display() and lcd.nodisplay() commands? You would send your text to the display and immediately turn it off. Then later, when you sense the push button or potentiometer position, you could turn it on or off as you desire.

Don

Yes but im still not 100% sure on what code i need for this i have been working on this for ages with no luck.

Image0532.jpg

Well i came up with this still its not what im affter this using 2 buttons to change { on } { off } message
i want to do this with just one button.?
Also has temp reading from input 0.
how do i change the message if the temp go over a set point?

#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 10, 9, 8, 7);

int SENSOR = 0;
float D = 0;
float T = 0;

void setup()
{
lcd.begin(20, 4);

attachInterrupt(0, ON, HIGH);
attachInterrupt(1, OFF, HIGH);
}

void loop()
{
lcd.setCursor(0,0);
lcd.print("FAN");
lcd.setCursor(0,1);
lcd.print("MONITOR");
delay(1000);

lcd.setCursor(5, 3);
D = analogRead(SENSOR);
T = (D * 4.81 * 100)/1023;

Serial.print(T);
Serial.println("C");

lcd.print(T);
lcd.print("C");
}

void ON()
{
lcd.setCursor(8,0);
lcd.print("ON ");
}

void OFF()
{
lcd.setCursor(8,0);
lcd.print("OFF");
}

turn on a message on the lcd and if the pot gose below 50% the message turns off

I guess you have me confused. I thought you wanted to turn the display on and off but your code displays the words "ON" and "OFF".

How about:

void ON()
{
  lcd.display();
}
   
void OFF()
{
lcd.nodisplay();
}

Note: When posting code you should highlight that code and use the 'code' button (the one with the '#' symbol).

To do this with one button you would use one interrupt and have the interrupt code toggle between which of the two functions it invokes.

Don

With respect to your photo - it's not too clear how the displays are wired, but have you seen this? Make sure you scroll down to the photos.

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1265969050

Don

Here are some better photos from my phone not the best.
well yes i do want to use just one button that was just a test realy. thats one part im trying to do.
also i want another message to come on when a pot gose over a set point like ( To High ) message and ( To Low ) ?
how would i have the code to toggle between the interrupt code.

#include <LiquidCrystal.h> // include the LCD library
LiquidCrystal lcd(12, 11, 6, 5, 4, 3);
LiquidCrystal lcd2(12, 10, 6, 5, 4, 3);

Thats how i have the 2x 20.4 LCDs working and to works great

Image0534.jpg

Image0536.jpg