Questions with regards to ESP8266 Basic and hardware interfacing and control via Basic commands

Moderator: Mmiscool

User avatar
By Ecoli-557
#54745 You may be facing the same thing I did using the solderless breadboards and SPI.
Check this post of mine:
I think I found out what was happening - the capacitance of the breadboards are wrecking the signals. See my other post on this: viewtopic.php?f=45&t=11446&p=54175#p54175

Hope this helps.
Regards to All.
User avatar
By tcpipchip
#54748 But i am having exactly the same problem in both boards, with and without breadboard :(


But did you BASIC is getting STACK CRASH too ?
User avatar
By Ecoli-557
#54752 I would download the lates Basic build again, re-flash, just to ensure you do not have a corrupted file.
If still having difficulty, try running it using the DEBUG function. I have found if it works in debug but not without, its a timing issue somewhere.

You also have the ability in DEBUG to slow down the execution which could prove helpful to see where your program is just before it blows up.

Regards.
User avatar
By tcpipchip
#54762 Hi,

Debug can't solve my problem!

I get the same problems in the both modules. With protoboard and without.

Please, burn there! Here the code that i am testing!

Thanks for your Help!

Code: Select alltft.setup(16, 4, 1)
tft.touch.setup(15)

spi.setfrequency(100000)

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

tft.text.cursor(160,5)
tft.print("RPM")
tft.text.cursor(160,55)
tft.print("TMP")
tft.text.cursor(160,105)
tft.print("VEL")
tft.text.cursor(160,155)
tft.print("MAF")
tft.text.cursor(160,205)
tft.print("POS")

but1 = tft.obj.button("SEL", 5,90,150,70,4)

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

Telnetbranch [obdii]

aaa = telnet.client.connect("192.168.1.111", 35000)
bbb = telnet.client.write("ATE0" & chr(13))

PID = 0
OPTION = 1
tft.obj.setvalue(bar1, 100)

Timer 250, [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
return

[obdii]
tcp = telnet.client.read.str()
tam = len(tcp)
if tam = 16 or tam = 13 then
   cmd = mid(tcp,6,2)
   if cmd = "0C" then
      tcp = hextoint(replace(mid(tcp,9,5)," ",""))
      tcp = str(int(tcp / 4))
      tft.obj.setlabel(bar1, tcp)
      if OPTION = 1 then
         tft.obj.setlabel(but1,tcp)
      end if
   end if
   if cmd = "05" then
      tcp = hextoint(replace(mid(tcp,9,5)," ",""))
      tcp = str(int(tcp) - 40)
      tft.obj.setlabel(bar2, tcp)
      if OPTION = 2 then
         tft.obj.setlabel(but1,tcp)
      end if
   end if
   if cmd = "0D" then
      tcp = hextoint(replace(mid(tcp,9,5)," ",""))
      tcp = str(int(tcp))
      tft.obj.setlabel(bar3, tcp)
      if OPTION = 3 then
         tft.obj.setlabel(but1,tcp)
      end if
   end if
   if cmd = "10" then
      tcp = hextoint(replace(mid(tcp,9,5)," ",""))
      tcp = str(int(tcp / 100))
      tft.obj.setlabel(bar4, tcp)
      if OPTION = 4 then
         tft.obj.setlabel(but1,tcp)
      end if
   end if
   if cmd = "11" then
      tcp = hextoint(replace(mid(tcp,9,5)," ",""))
      tcp = str(int(tcp * 0.392156))
      tft.obj.setlabel(bar5, tcp)
      if OPTION = 5 then
         tft.obj.setlabel(but1,tcp)
      end if
   end if
end if

wait

[rpm]
PID = PID + 1
if PID = 6 then
   PID = 0
end if
if PID = 1 then
   ccc = telnet.client.write("01 0C" & chr(13))
end if
if PID = 2 then
   ccc = telnet.client.write("01 05" & chr(13))
end if
if PID = 3 then
   ccc = telnet.client.write("01 0D" & chr(13))
end if
if PID = 4 then
   ccc = telnet.client.write("01 10" & chr(13))
end if
if PID = 5 then
   ccc = telnet.client.write("01 11" & chr(13))
end if
wait