Antonio Teixeira
Member
Hi everyone,
I am trying to do something in B4R with the code I post here but for some reason that I cant understand I have an error in the code.
Any help please?
Thank you
#Region Project Attributes
#AutoFlushLogs: True
#CheckArrayBounds: True
#StackBufferSize: 300
#End Region
Sub Process_Globals
Public astream As AsyncStreams
Public ReceivedCommand() As Byte
Public Serial1 As Serial
Public bc As ByteConverter
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
astream.Initialize(Serial1.Stream, "Astream_NewData", "Astream_Error")
'
End Sub
Sub Astream_NewData (Buffer() As Byte)
ReceivedCommand = bc.SubString2(Buffer, 0,2) ' <<<<<< This line dont compile with
' Main - 25: Cannot modify Const variable. (global non-primitive variables are always constants.)
Log("ReceivedCommand: ", ReceivedCommand)
End Sub
Sub AStream_Error
Log("error")
End Sub
I am trying to do something in B4R with the code I post here but for some reason that I cant understand I have an error in the code.
Any help please?
Thank you
#Region Project Attributes
#AutoFlushLogs: True
#CheckArrayBounds: True
#StackBufferSize: 300
#End Region
Sub Process_Globals
Public astream As AsyncStreams
Public ReceivedCommand() As Byte
Public Serial1 As Serial
Public bc As ByteConverter
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
astream.Initialize(Serial1.Stream, "Astream_NewData", "Astream_Error")
'
End Sub
Sub Astream_NewData (Buffer() As Byte)
ReceivedCommand = bc.SubString2(Buffer, 0,2) ' <<<<<< This line dont compile with
' Main - 25: Cannot modify Const variable. (global non-primitive variables are always constants.)
Log("ReceivedCommand: ", ReceivedCommand)
End Sub
Sub AStream_Error
Log("error")
End Sub