more information: i get a "connection refused" error. I am trying to access the AT commands via the wifi not the uart pins. If i sell a sensor to a customer with the esp8266 attached, how can they set their own ssid and password?
using a usb to serial board and realterm, i have set an ESP8266 to server mode. Then disconnection all pins except power and ground i see the the module in wifi scan. I connect to module via wifi. Then i try to connect via client program, i get "no connection". I am using 192.168.4.1 port 333. Help please
#Region Project Attributes
#ApplicationLabel: Client first
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim Socket As Socket
Dim AStreams As AsyncStreams
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
'Dim AStreams As AsyncStreams
Private Connect As Button
Public Data2send As EditText
Public Send As Button
Public edittext1 As EditText
Private EditText2 As EditText
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("client_send")
Socket.Initialize("Socket")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Connect_Click
'Socket.Initialize("Socket")
If Socket.Connected=False Then
Socket.Connect("192.168.4.1",333,20000)'this is esp8266 wifi
End If
Dim buffer() As Byte
buffer = Data2send.Text.GetBytes("UTF8")
buffer="ty this".GetBytes("ASCII")
End Sub
Sub Send_Click
'Dim ts As OutputStream
'AStreams.Initialize(Socket.InputStream,Socket.OutputStream, "AStreams")
Dim buffer() As Byte
buffer = Data2send.Text.GetBytes("UTF8")
AStreams.Write(buffer)
Data2send.Text="sent"
End Sub
Sub Socket_Connected (Successful As Boolean)
If Successful = False Then
Msgbox(LastException.Message, "Error connecting")
Return
End If
AStreams.Initialize(Socket.InputStream,Socket.OutputStream, "AStreams")
Dim tr As TextReader
tr.Initialize2(Socket.InputStream,"UTf8")
edittext1.Text="ooooo"
'Msgbox("Time received: " & CRLF & sb.ToString, "")
Data2send.Text="lllsll"
' Socket.Close
End Sub
Sub AStreams_NewData (Buffer() As Byte)
Dim msg As String
'edittext1.Text="uuuuuu"
msg = BytesToString(Buffer, 0, Buffer.Length, "UTF8")
'ToastMessageShow(msg, False)
Data2send.Text=msg
End Sub