Display GPIO state with text

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
asuz
Normal user
Posts: 175
Joined: 31 Oct 2018, 18:22

Display GPIO state with text

#1 Post by asuz » 13 Mar 2019, 19:43

How can I display GPIO state with text instead of number at LCD Screen. For example, if GPIO 12 state is 1 LCD Screen display ON, if GPIO 12 state is 0 LCD Screen display OFF.

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Display GPIO state with text

#2 Post by grovkillen » 13 Mar 2019, 19:55

Later versions let you do this by adding a converter for translating 1/0 to ON/OFF etc. Don't have the exact syntax in my head now but look for "pinstate" or similar. I will try to look more tomorrow.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

Domosapiens
Normal user
Posts: 307
Joined: 06 Nov 2016, 13:45

Re: Display GPIO state with text

#3 Post by Domosapiens » 13 Mar 2019, 22:18

From my notes:

Format Transformation:
Feature to transform Values from numeric to strings or to format numeric values.
Syntax:
[task#value#transformation#justification]
Where #transformation is:
Format of PIN states of GPIO (0 or 1)
#V: value unformatted
#O: 1/0 -> ON/OFF
#C: 1/0 -> OPEN/CLOSE
#U: 1/0 -> UP/DOWN
#u: 1/0 -> U/D
#Y: 1/0 -> YES/NO
#y: 1/0 -> Y/N
#I: 1/0 -> IN/OUT
#X: 1/0 -> X/O
#Z: 1/0 -> 1/0
Adding ! to any of the above formatting inverts the logic.
So for example:
#O! 1/0 -> OFF/ON
#Z! 1/0 -> 0/1
#Y! 1/0 -> NO/YES
Format of any number value (floats):
#Dx.y: x digits + y decimals
#E: convert to ceiling
#F: convert to floor
Examples (value = 3.1415):
#D -> 3
#D3 -> 003
#D.2 -> 3.14
#D3.2 -> 003.14
#E -> 4
#F -> 3
#R: justifies the latest value to the right according to the number of characters exported by the LCD (tested on LCD). Not tested on other displays.
Justification formats applis to the transformed value:
#Pn: prefix with padding spaces
#Sn suffix with padding spaces
Example (value = 1)
#U#S5 -> UP (+3 spaces)
#U#P5 -> (3 spaces) UP
New Transformations:
#H: Hot/Cold
#M: Man/Auto
#m: M/A
New Justifications:
#Lx: Left (x=number of chars)
#Rx: Right (x=number of chars)
#Ux.y: Substring (x=first char; y=number of chars)
30+ ESP units for production and test. Ranging from control of heating equipment, flow sensing, floor temp sensing, energy calculation, floor thermostat, water usage, to an interactive "fun box" for my grandson. Mainly Wemos D1.

asuz
Normal user
Posts: 175
Joined: 31 Oct 2018, 18:22

Re: Display GPIO state with text

#4 Post by asuz » 13 Mar 2019, 22:38

Domosapiens wrote: 13 Mar 2019, 22:18 From my notes:

Format Transformation:
Feature to transform Values from numeric to strings or to format numeric values.
Syntax:
[task#value#transformation#justification]
................
Wonderful property, thank you very much for your guidance. Just wonder one more think about that transformation, what if I need to transform 1 to ABCD and 0 to EFGH instead of ON or OFF?

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Display GPIO state with text

#5 Post by grovkillen » 14 Mar 2019, 05:49

You mean custom names? The list of transformations aren't covering your need?
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

asuz
Normal user
Posts: 175
Joined: 31 Oct 2018, 18:22

Re: Display GPIO state with text

#6 Post by asuz » 14 Mar 2019, 16:41

grovkillen wrote: 14 Mar 2019, 05:49 You mean custom names? The list of transformations aren't covering your need?
Isn't it possible with rules?

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Display GPIO state with text

#7 Post by grovkillen » 14 Mar 2019, 16:55

No it's not. Unless you use if states etc. But what do you want to do exactly?
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

asuz
Normal user
Posts: 175
Joined: 31 Oct 2018, 18:22

Re: Display GPIO state with text

#8 Post by asuz » 14 Mar 2019, 19:21

grovkillen wrote: 14 Mar 2019, 16:55 No it's not. Unless you use if states etc. But what do you want to do exactly?
I need to display translation of ON and OFF in my language for one of my project. Sometimes people who doesnot know English are confuse ON and OFF meaning.

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Display GPIO state with text

#9 Post by grovkillen » 14 Mar 2019, 21:07

Ok, then you need to do some if statements and LCD commands.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

asuz
Normal user
Posts: 175
Joined: 31 Oct 2018, 18:22

Re: Display GPIO state with text

#10 Post by asuz » 15 Mar 2019, 19:43

grovkillen wrote: 14 Mar 2019, 21:07 Ok, then you need to do some if statements and LCD commands.
OK, thank you, i will try

Post Reply

Who is online

Users browsing this forum: No registered users and 21 guests