How do I add double quotes in a string to be sent down Uart?
Ive tried adding a \ before each " but does not work.
Cant find any reference to this on forum or website .
' main program...
Sub Main()
while true
console.write($22, "this is my text", $22)
console.write(13,10)
delayms(1000)
end while
End Sub
uart2.write("T+CPMS=",$22,"SM",$22,",",$22,"SM",$22,",",$22,"SM",$22)
imports uart2
Sub writeCmd(command As String)
dim index as byte = 0
// loop until string terminator found...
while command(index) <> nothing
// look for single quote - if found, then
// emit double quote...
if command(index) = cchar($27) then
uart2.write($22)
// else just write the char...
else
uart2.write(command(index))
end if
index += 1
end while
End Sub
sub main()
writeCmd("T+CPMS='SM','SM','SM'")
end sub
' Imports section...
' Declarations...
' import Uart modules...
imports Uart
imports Uart2
Imports Strings
' main program entry point...
Sub Main()
Uart.SetBaudrate(Uart.Baudrate.Is38400)
Uart2.SetBaudrate(Uart2.Baudrate.Is4800)
Uart.ReadTerminator = 13
dim command as string
dim number1 as string
dim b as string(256)
dim nxtStr as ushort = 0
dim data as byte = 0
Uart2.Write("AT",13,10)
'Uart2.Write("ATEO",13,10)
'Uart2.Write("AT+CVHU=0",13,10)
'Uart2.Write("AT+CPMS=",$22,"SM",$22,",",$22,"SM",$22,",",$22,"SM",$22,13,10)
' Uart.Write("AT+CPMS=",$22,"SM",$22,",",$22,"SM",$22,",",$22,"SM",$22,13)
while true
nxtStr = 0
data = 0
if uart.DataAvailable then
Uart.Read(command)
'Uart2.Write("AT+CPMS=",$22,"SM",$22,",",$22,"SM",$22,",",$22,"SM",$22,13,10)
Uart2.Write(command,13,10)
end if
delayms(100)
if Uart2.DataAvailable then
'Console.Write("data here")
do
data = Uart2.Readbyte()
b(nxtStr) = data
nxtStr += 1
loop until data = 13
'Uart.WriteByte(Uart2.ReadByte())
Console.Write("reply is ",b)
'uart2.read(number1)
'Uart.Write(number1,13,10)
end if
end while
End Sub
Users browsing this forum: No registered users and 1 guest