I can't find the answer to this. I am using B4R 2.51 and a WeMos D1 R2 WiFi.
I would like to create a global public array variable, set its value in AppStart, then use it in a third subroutine.
But, It gives me the error:
Cannot modify Const variable. (global non-primitive variables are always constants).
Is there a way to create global arrays?
Is there a trick other than making pkton/off entirely local to Sub SendBulb?
Thanks,
Barry.
I would like to create a global public array variable, set its value in AppStart, then use it in a third subroutine.
B4X:
Sub Process_Globals
...
Public pktOff(), pktOn() As Byte
...
End Sub
B4X:
Sub AppStart
...
pktOff = bc.HexToBytes("2A00003418DD000000000000000000000000000000000100000000000000000075000000000064000000")
pktOn = bc.HexToBytes("2A00003418DD000000000000000000000000000000000100000000000000000075000000FFFF64000000")
...
End Sub
B4X:
Sub SendBulb(bon as boolean)
...
If (bon) Then ' bon = true, bulb is on
wudp.Write(pktOn)
Else
wudp.Write(pktOff)
End If
...
End Sub
But, It gives me the error:
Cannot modify Const variable. (global non-primitive variables are always constants).
Is there a way to create global arrays?
Is there a trick other than making pkton/off entirely local to Sub SendBulb?
Thanks,
Barry.