General area when it fits no where else

Moderator: Mmiscool

User avatar
By tcpipchip
#58301
Code: Select allIR  = "IR"
PID = 0
VLU = 0

tft.setup(16, 4, 3)
tft.touch.setup(15)

tft.cls
tft.fill(tft.rgb(0,255,0))

tft.line(10,10,20,20,tft.rgb(255,0,0))

tft.text.color(tft.rgb(202,172,209))
tft.text.cursor(160,5)
tft.print("RPM")
tft.text.color(tft.rgb(50,34,11))
tft.text.cursor(160,55)
tft.print("TMP")
tft.text.color(tft.rgb(144,137,126))
tft.text.cursor(160,105)
tft.print("VEL")
tft.text.color(tft.rgb(235,78,56))
tft.text.cursor(160,155)
tft.print("MAF")
tft.text.color(tft.rgb(25,89,215))
tft.text.cursor(160,205)
tft.print("POS")

'tft.bmp("/uploads/cat.bmp")

bar1 = tft.obj.bar("RPM",200,0,120,30, 2, 65535, tft.rgb(0,25,255))
bar2 = tft.obj.bar("TEMPERA",200,50,120,30, 2, 65535, tft.rgb(0,25,255))
bar3 = tft.obj.bar("VELOCID",200,100,120,30, 2, 65535, tft.rgb(0,25,255))
bar4 = tft.obj.bar("AIRFLOW",200,150,120,30, 2, 65535, tft.rgb(0,25,255))
bar5 = tft.obj.bar("POSITION",200,200,120,30, 2, 65535, tft.rgb(0,25,255))

for l=1 to 100 step 10
tft.obj.setvalue(bar1, l)
tft.obj.setvalue(bar2, l)
tft.obj.setvalue(bar3, l)
tft.obj.setvalue(bar4, l)
tft.obj.setvalue(bar5, l)
next l

lab2 = tft.obj.label("19:41:16",90,120,100,18, 2, tft.rgb(0,255,0))

tft.circle.fill(160,200,50,65535)

tft.rect.round(10,10,100,100,5,tft.rgb(0,0,255))

tft.rect.fill(10,10,20,20,tft.rgb(0,0,255))

tft.circle(160,90,50,65535)

but1 = tft.obj.button("SEL", 5,0,150,70,4)
but2 = tft.obj.button("SEL", 5,175,150,70,4)

tft.obj.setlabel(but1,"0000")
tft.obj.setlabel(but2,"1111")

chk1 = tft.obj.checkbox("Check Me", 5,80,40,1, 3, 65535, 0)

rad1 = tft.obj.radio("Radio", 5,130,50,1, 3)

Telnetbranch [answer]
aaa = telnet.client.connect("192.168.1.111", 1024)

CNT = 0
RCV = 0
OPTION = 1

udpbegin 1025
UdpBranch [received]
Timer 1000, [rpm]
touchbranch [touchme]
msgbranch [mybranch]

ir.recv.setup(2)
irbranch [infrared]

goto [BACKWEB]

[touchme]
touch_obj = tft.checktouch()

if touch_obj = but1 then

  tft.obj.invert(but1)

  OPTION = OPTION + 1
  if OPTION = 6 then
     OPTION = 1
  end if

  if OPTION = 1 then
     tft.obj.setvalue(bar1, 100)
  else
     tft.obj.setvalue(bar1, 0)
  end if

  if OPTION = 2 then
     tft.obj.setvalue(bar2, 100)
  else
     tft.obj.setvalue(bar2, 0)
  end if

  if OPTION = 3 then
     tft.obj.setvalue(bar3, 100)
  else
     tft.obj.setvalue(bar3, 0)
  end if

  if OPTION = 4 then
     tft.obj.setvalue(bar4, 100)
  else
     tft.obj.setvalue(bar4, 0)
  end if

  if OPTION = 5 then
     tft.obj.setvalue(bar5, 100)
  else
     tft.obj.setvalue(bar5, 0)
  end if

end if

if touch_obj = but2 then
  tft.obj.invert(but2)
end if

if touch_obj = chk1 then
  tft.obj.setlabel(lab1, "checkbox")
  tft.obj.invert(chk1)
end if

if touch_obj = rad1 then
  tft.obj.invert(rad1)
end if

return

[answer]
CNT = CNT + 1
tft.obj.setlabel(but2,str(CNT))
tcp = telnet.client.read.str()
tft.obj.setlabel(lab2, tcp)
wait

[rpm]
PID = PID + 1
tft.obj.setlabel(but1,str(PID))
ccc = telnet.client.write(      "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" & chr(13))
udpwrite "192.168.1.111", 1025, "VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV"
tft.obj.setlabel(bar3,mens4)
tft.obj.setlabel(bar4,mens5)
tft.obj.setvalue(bar1, mens3)
mens1 = str(PID)
x = mens3
tft.obj.invert(but1)
wait

[received]
rec = udpread()
RCV = RCV + 1
tft.obj.setlabel(bar1,str(RCV))
tft.obj.setlabel(lab2, rec)
'serialprintln rec
return

[Pressed]
wprint "pressed"
wait

[mybranch]
VLU = VLU + 1
butt = msgget("button")
serialprintln butt
if butt == "newweb" then
   goto [NEWWEB]
end if
if butt == "backweb" then
   goto [BACKWEB]
end if
'msgreturn butt
RETURNGUI
wait

[load]
'wprint "Very cool"
wait

[infrared]
let r = ir.recv.full()
'serialprintln r
s = instr(r,"e17a807f:NEC:32")
if s>0 then
   serialprintln "Pressed 1"
   IR = r
   RETURNGUI
   return
end if
s = instr(r,"e17a40bf:NEC:32")
if s>0 then
   serialprintln "Pressed 2"
   IR = r
   RETURNGUI
   return
end if
return

[NEWWEB]
serialprintln "************************************"
cls
wprint |<HTML>| & chr(13)
wprint |<HEAD>| & chr(13)
wprint |<meta name="apple-mobile-web-app-capable" content="yes" />|
wprint |<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />|
wprint |<link rel="stylesheet" type="text/css" href="http://randomnerdtutorials.com/ethernetcss.css" />|
wprint |<TITLE>NEWWEB</TITLE>| & chr(13)
'wprint |<meta http-equiv="refresh" content="5" />| & chr(13)
wprint |</HEAD>| & chr(13)
wprint |<BODY>| & chr(13)
wprint |<H1>NEWWEB</H1>| & chr(13)
wprint |<hr />| & chr(13)
wprint |<br />| & chr(13)
wprint |<H2>ESP8266</H2>| & chr(13)
wprint |<br />| & chr(13)
wprint |<a href="/msg?button=3on"">Turn On LED</a>| & chr(13)
wprint |<a href="/msg?button=3off"">Turn Off LED</a><br />| & chr(13)
wprint |<br />| & chr(13)
wprint htmlvar(PID)
wprint |<br />| & chr(13)
wprint htmlvar(VLU)
wprint |<br />| & chr(13)
wprint htmlvar(IR)
wprint |<br />| & chr(13)
wprint |<br />| & chr(13)
wprint |<a href="/msg?button=4on"">Rotate Left</a>| & chr(13)
wprint |<a href="/msg?button=4off"">Rotate Right</a><br />| & chr(13)
wprint |<br />| & chr(13)
wprint |<br />| & chr(13)
wprint |<a href="/msg?button=backweb"">BACKWEB</a>| & chr(13)
wprint |<p>Created by Miguel</p>| & chr(13)
wprint |<br />| & chr(13)
wprint |</BODY>| & chr(13)
wprint |</HTML>| & chr(13)   
RETURNGUI
wait               
'---------------------------------

[BACKWEB]
serialprintln "++++++++++++++++++++++++++++++++++++"
cls
wprint |<HTML>| & chr(13)
wprint |<HEAD>| & chr(13)
wprint |<meta name="apple-mobile-web-app-capable" content="yes" />|
wprint |<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />|
wprint |<link rel="stylesheet" type="text/css" href="http://randomnerdtutorials.com/ethernetcss.css" />|
wprint |<TITLE>TEST WEB ACCESS</TITLE>| & chr(13)
'wprint |<meta http-equiv="refresh" content="5" />| & chr(13)
wprint |</HEAD>| & chr(13)
wprint |<BODY>| & chr(13)
wprint |<H1>TEST WEB ACCESS</H1>| & chr(13)
wprint |<hr />| & chr(13)
wprint |<br />| & chr(13)
wprint |<H2>ESP8266</H2>| & chr(13)
wprint |<br />| & chr(13)
wprint |<a href="/msg?button=1on"">Turn On LED</a>| & chr(13)
wprint |<a href="/msg?button=1off"">Turn Off LED</a><br />| & chr(13)
wprint |<br />| & chr(13)
wprint htmlvar(PID)
wprint |<br />| & chr(13)
wprint htmlvar(VLU)
wprint |<br />| & chr(13)
wprint htmlvar(IR)
wprint |<br />| & chr(13)
wprint |<br />| & chr(13)
wprint |<a href="/msg?button=2on"">Rotate Left</a>| & chr(13)
wprint |<a href="/msg?button=2off"">Rotate Right</a><br />| & chr(13)
wprint |<br />| & chr(13)
wprint |<br />| & chr(13)
wprint |<a href="/msg?button=newweb"">NEWWEB</a>| & chr(13)
wprint |<p>Created by Miguel</p>| & chr(13)
wprint |<br />| & chr(13)
wprint |</BODY>| & chr(13)
wprint |</HTML>| & chr(13)                  
RETURNGUI
wait               
'---------------------------------
User avatar
By Electroguard
#58307 Well that looks to be an impressive and intriquing list of functionality stuffed into one container... what does it do, and what hardware would I need to hook up (looks like everything but the kitchen sink!) to see it doing its business?
User avatar
By tcpipchip
#58321 Well, the functionality list are , TFT 320x240 TOUCH test, timer test, udp and tcp client test with ECHO, infrared receiver, etc
Looks working good with some browsers!
Testing on nodemcu 0.9 + SPI TFT (no more bugs)

Yes, i think about a product in 2017, but, need to do many tests...i am changing the C source code...tryng to find bugs while upgrading the BASIC example....

Next step, add transmiter infrared...