-->
Page 1 of 1

TELNET RECEIVE EVENT

PostPosted: Tue Oct 25, 2016 9:45 am
by tcpipchip
Not works on DEBUG

Code: Select all'---------------------------------
cssclass "button", "background-color: yellow;"
'cls
'wprint "<head>"
'wprint "<meta http-equiv='refresh' content='5'>"
'wprint "</head>"
wprint "hello"
dropdown mens4, "One,Two,Three"
button "hello" , [Pressed]
textbox mens1
passwordbox mens2
slider mens3, 1, 100
listbox mens5, "One,Two,Three", 5
x = 50
meter x, 0, 100
'image "logo.bmp"
'msgbranch [mybranch]
'print "set the branch"
'onload [load]
wprint htmlvar(mens1)
'---------------------------------

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
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)

PID = 0
CNT = 0
RCV = 0
OPTION = 1

udpbegin 1025
UdpBranch [received]
Timer 50, [rpm]
touchbranch [touchme]

wait

[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]
myColorVar = msgget("color")
print myColorVar
let myReturnMsg = "You Entered " & myColorVar
msgreturn myReturnMsg
wait

[load]
'wprint "Very cool"
wait