I'm using an HD223 with GPIO pins 3/11 set to their alternate function of serial rx/tx. I wrote a custom plugin that can read serial well enough, but when I try to write something back, the receiving Arduino gets back the first letter or two of what I send, but then some garbage characters. In addition, I'm getting one or more bytes sent across serial when the BrightSign boots. I do not have serial logging turned on. Are there any obvious issues with my plugin? (Sorry, I don't know who to format this as code on this forum)
Function carlSerial_Initialize(msgPort As Object, userVariables As Object, o As Object)
print "carlSerial entry"
CarlSerial = newCarlSerial(msgPort, userVariables)
return CarlSerial
End Function
Function newCarlSerial(msgPort as Object, userVariables as Object)
print "newCarlSerial entry"
print "Before Serial in newCarlSerial"
c = CreateObject("roControlPort", "BrightSign")
c.EnableAlternateFunction(0, "serial1")
c.EnableAlternateFunction(6, "serial1")
print "After Serial in newCarlSerial"
CarlSerial = { }
CarlSerial.msgPort = msgPort
CarlSerial.userVariables = userVariables
CarlSerial.objectName = "CarlSerial_object"
CarlSerial.ProcessEvent = carlSerial_ProcessEvent
gaa = GetGlobalAA()
if gaa.myserial = invalid then
print "Creating myserial"
gaa.myserial = CreateObject("roSerialPort", 1, 115200)
print "Setting myserial port"
gaa.myserial.SetLineEventPort(CarlSerial.msgPort)
print "Done setting up myserial"
end if
return CarlSerial
End Function
Function carlSerial_ProcessEvent(event As Object) as boolean
if type(event) = "roStreamLineEvent" then
serialCmd$ = event.getstring()
if Left(serialCmd$, 3) = "VER" then
gaa = GetGlobalAA()
'print "RECEIVED VERSION REQUEST"
gaa.myserial.SendBlock("llama")
'print "SENT LLAMA"
else
'print serialCmd$
end if
return true
else
return false
end if
End Function