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
Private BC As ByteConverter
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log("AppStart")
SplitIP("192.168.1.123")
End Sub
Sub SplitIP(IPbuffer() As Byte )
Dim IP(4) As Byte
Dim idx As Byte 'array index counter
For Each s() As Byte In BC.Split(IPbuffer, ".") 'split string and get each byte of IP address
Dim IPval As Byte = Bit.ParseInt(BC.StringFromBytes(s),10) 'get value
IP(idx) = IPval 'IP array holds the four bytes of IP address
Log(IP(idx))
idx = idx + 1
Next
End Sub
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
Private BC As ByteConverter
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log("AppStart")
SplitIP("192.168.1.123")
End Sub
Sub SplitIP(IPbuffer() As Byte )
Dim IP(4) As Byte
Dim idx As Byte 'array index counter
For Each s() As Byte In BC.Split(IPbuffer, ".") 'split string and get each byte of IP address
Dim IPval As Byte = Bit.ParseInt(BC.StringFromBytes(s),10) 'get value
IP(idx) = IPval 'IP array holds the four bytes of IP address
Log(IP(idx))
idx = idx + 1
Next
End Sub
Example 1: Integer to String Conversion Arduino
int a = 1234;
String myStr;
myStr = String(a); //Converts integer to string
Example 2: String to Integer conversion Arduino
String val = “1234”;
int result = val.toInt(); //Converts string to integer
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.