Good day
Please help to connect SIM808 module to ESP8266. Is that code and connection right?
Please help to connect SIM808 module to ESP8266. Is that code and connection right?
B4X:
#Region Project Attributes
#AutoFlushLogs: True
#CheckArrayBounds: True
#StackBufferSize: 1000
#End Region
Sub Process_Globals
Public Serial1 As Serial
Public Serial2 As SoftwareSerial
' Private BC As ByteConverter
Private AStream As AsyncStreams
Private EOL() As Byte = Array As Byte(13, 10)
Private Timer1 As Timer
Private pin2 As Pin
End Sub
Sub AppStart
Serial1.Initialize(115200)
Serial2.Initialize(115200, 3, 1)
AStream.Initialize(Serial2.Stream, "AStream_NewData", "AStream_Error")
AStream.WaitForMoreDataDelay = 100
Log("AppStart")
pin2.Initialize(2, pin2.MODE_OUTPUT)
Timer1.Initialize("Timer1_Tick", 1000)
Timer1.Enabled = True
End Sub
Sub Timer1_Tick
AStream.Write("AT").Write(EOL)
' AStream.Write("AT+CPIN?").Write(EOL)
pin2.DigitalWrite(Not(pin2.DigitalRead))
End Sub
Sub AStream_NewData (Buffer() As Byte)
Log("-> ", Buffer)
' Log("-> ", BC.StringFromBytes(Buffer))
End Sub
Sub AStream_Error
Log("Error")
End Sub