smallbasicでesp8266
4529 ワード
esp8266をテストするため、作った。
写真
サンプルコード
c = Text.GetCharacter(34)
n = Text.GetCharacter(13) + Text.GetCharacter(10)
button0 = Controls.AddButton("open", 30, 20)
button1 = Controls.AddButton("AT+GMR", 90, 20)
button2 = Controls.AddButton("AT+RST", 170, 20)
button3 = Controls.AddButton("AT+CWMODE=1", 250, 20)
button4 = Controls.AddButton("AT+CWJAP", 370, 20)
button5 = Controls.AddButton("AT+CIPMUX=1", 30, 80)
button6 = Controls.AddButton("AT+CIPSERVER", 170, 80)
button7 = Controls.AddButton("AT+CIPSTO=15", 300, 80)
button8 = Controls.AddButton("AT+CIFSR", 420, 80)
Controls.ButtonClicked = OnButtonClicked
mtextbox0 = Controls.AddMultiLineTextBox(10, 150)
Controls.SetSize(mtextbox0, 300, 200)
Controls.SetTextBoxText(mtextbox0, "send" + n)
mtextbox1 = Controls.AddMultiLineTextBox(320, 130)
Controls.SetSize(mtextbox1, 300, 300)
Controls.SetTextBoxText(mtextbox1, "recv" + n)
Sub OnButtonClicked
button = Controls.LastClickedButton
If (button = button0) Then
class1.OpenPort("COM5", 115200)
class1.SetHandshake("n")
text = Controls.GetTextBoxText(mtextbox0)
Controls.SetTextBoxText(mtextbox0, text + ">open" + n)
ElseIf (button = button1) Then
class1.TXString("AT+GMR" + n)
text = Controls.GetTextBoxText(mtextbox0)
Controls.SetTextBoxText(mtextbox0, text + ">AT+GMR" + n)
Program.Delay(200)
s = Class1.RXAll()
if s <> "" then
text = Controls.GetTextBoxText(mtextbox1)
Controls.SetTextBoxText(mtextbox1, text + s + n)
EndIf
ElseIf (button = button2) Then
class1.TXString("AT+RST" + n)
text = Controls.GetTextBoxText(mtextbox0)
Controls.SetTextBoxText(mtextbox0, text + ">AT+RST" + n)
Program.Delay(2000)
s = Class1.RXAll()
if s <> "" then
text = Controls.GetTextBoxText(mtextbox1)
Controls.SetTextBoxText(mtextbox1, text + s + n)
EndIf
ElseIf (button = button3) Then
class1.TXString("AT+CWMODE=1" + n)
text = Controls.GetTextBoxText(mtextbox0)
Controls.SetTextBoxText(mtextbox0, text + ">AT+CWMODE=1" + n)
Program.Delay(2000)
s = Class1.RXAll()
if s <> "" then
text = Controls.GetTextBoxText(mtextbox1)
Controls.SetTextBoxText(mtextbox1, text + s + n)
EndIf
ElseIf (button = button4) Then
class1.TXString("AT+CWJAP=" + c +"WARPSTAR-CB39F1" + c + "," + c + "" + c + n)
text = Controls.GetTextBoxText(mtextbox0)
Controls.SetTextBoxText(mtextbox0, text + ">AT+CWJAP" + n)
Program.Delay(2000)
s = Class1.RXAll()
if s <> "" then
text = Controls.GetTextBoxText(mtextbox1)
Controls.SetTextBoxText(mtextbox1, text + s + n)
EndIf
ElseIf (button = button5) Then
class1.TXString("AT+CIPMUX=1" + n)
text = Controls.GetTextBoxText(mtextbox0)
Controls.SetTextBoxText(mtextbox0, text + ">AT+CIPMUX=1" + n)
Program.Delay(200)
s = Class1.RXAll()
if s <> "" then
text = Controls.GetTextBoxText(mtextbox1)
Controls.SetTextBoxText(mtextbox1, text + s + n)
EndIf
ElseIf (button = button6) Then
class1.TXString("AT+CIPSERVER=1,80" + n)
text = Controls.GetTextBoxText(mtextbox0)
Controls.SetTextBoxText(mtextbox0, text + ">AT+CIPSERVER" + n)
Program.Delay(200)
s = Class1.RXAll()
if s <> "" then
text = Controls.GetTextBoxText(mtextbox1)
Controls.SetTextBoxText(mtextbox1, text + s + n)
EndIf
ElseIf (button = button7) Then
class1.TXString("AT+CIPSTO=15" + n)
text = Controls.GetTextBoxText(mtextbox0)
Controls.SetTextBoxText(mtextbox0, text + ">AT+CIPSTO=15" + n)
Program.Delay(200)
s = Class1.RXAll()
if s <> "" then
text = Controls.GetTextBoxText(mtextbox1)
Controls.SetTextBoxText(mtextbox1, text + s + n)
EndIf
ElseIf (button = button8) Then
class1.TXString("AT+CIFSR" + n)
text = Controls.GetTextBoxText(mtextbox0)
Controls.SetTextBoxText(mtextbox0, text + ">AT+CIFSR" + n)
Program.Delay(200)
s = Class1.RXAll()
if s <> "" then
text = Controls.GetTextBoxText(mtextbox1)
Controls.SetTextBoxText(mtextbox1, text + s + n)
EndIf
EndIf
EndSub
Author And Source
この問題について(smallbasicでesp8266), 我々は、より多くの情報をここで見つけました https://qiita.com/ohisama@github/items/fd2f0ab78b7c0e84c8a3著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .