Start a new topic

how to generate an alert

Maybe im over thinking this but I want to be able to generate an alert during a "failure condition" for my project. I have most functions working well. I can read back sensors and display messages on the nextion board and I can print a temperature to the board. I simply want an error message in the form of an icon to be generated during a failure. Im just not sure how to do this.

page5 new.png
(40.1 KB)
page 1 new.png
(32.7 KB)

BTW im using an arduino uno.

add alert picture in the picture resources of your HMI

use pic to place alert, xpic to remove alert

1 person likes this

Thanks Patrick,

do I need some sort of call back function at the code level for Arduino or is that done at the HMI level ?

to speak with king Solomon words ....

"it is done as you decide and code ..."

1 person likes this

where is the sensor?

The only reasonable way for an alert to work is at the location where

   the calculations are made for an alert.

And, the MCU should always be in control in an HMI application.

Therefore, along the lines of

 - read sensor

 - determine if value is out of acceptable range

    if out of range

       - make corrective measures to prevent further harm

       - raise the alert, show status for Humans

    - if not

        - clear the alert, show status for Humans

sensor is hooked directly to the arduino.So the MC handles errors as it should. In the event of over temp the MC shuts off the heater, in the event of water level failure the MC shuts down pumps. I dont really need a visual alert but it`s nice. I could simply put in a light or a buzzer and have that as an alert but I already know how to do that so im not learning.

So you already have a line that does these calculations

at the point in code where your MCU now knows if alert status

use sendCommand() to issue your command to Nextion

for an alert graphic - first include the graphic in picture resources

to issue the alert - use the pic command to draw your alert

to remove the alert - use the picq or xpic to draw over with original

Maybe something like this:


if (x < minTemp || x > maxTemp)  //if the temperature falls outside the permitted range
  if (setPic == HIGH)
  setPic = LOW;
  setPic = HIGH;
  digitalWrite(TxPin, setPic);

I made these allert lights for on and off...





Login or Signup to post a comment