#Region Project Attributes
#AutoFlushLogs: True
#CheckArrayBounds: True
#StackBufferSize: 10000
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'Public variables can be accessed from all modules.
Public Serial1 As Serial
Public bc As ByteConverter
Private SoftSerial As SoftwareSerial
Private astream As AsyncStreams
Private m_t1 As Timer
End Sub
Private Sub AppStart
m_t1.Initialize("m_t1_Tick",2000) 'collect io data
m_t1.Enabled=False
Serial1.Initialize(57600)
SoftSerial.Initialize(57600,12,13) '6=rx 7=tx
astream.Initialize(SoftSerial.Stream, "astream_NewData", Null)
astream.MaxBufferSize=265
Log("AppStart")
m_t1.Enabled=True
End Sub
Sub m_t1_Tick
test
Delay(5)
End Sub
Sub test
'02 30 33 34 36 30 37 44 45 30 30 36 34 38 39 03
Dim b(16) As Byte
b(0)=0x02
b(1)=0x30
b(2)=0x33
b(3)=0x34
b(4)=0x36
b(5)=0x30
b(6)=0x37
b(7)=0x44
b(8)=0x45
b(9)=0x30
b(10)=0x30
b(11)=0x36
b(12)=0x34
b(13)=0x38
b(14)=0x39
b(15)=0x03
astream.Write(b)
Delay(9)
End Sub
Sub astream_NewData (buffer() As Byte)
Log("Buffer Length: ",buffer.Length," Buffer: ",bc.HexFromBytes(buffer))
End Sub