Re: Serial Port comunication witch arduino
Posted: Tue Dec 17, 2019 10:35 am
mk-soft,
many thanks for your patience.
Your code works good as it is.
If I replace #CRLF$ by CRLF$ it does not work.
\DataBit = 8
\StopBit = 1
\Handshake = #PB_SerialPort_NoHandshake
\BufferSize = 2048
\EndOfText = #CRLF$ <--------with only CRLF$ it do not work !
\StatusCB = @StatusCB()
\ReceiveCB = @ReceiveCB()
\ThreadID = CreateThread(@thComport(), ComData)
I think only 2 procedures are important for me
Procedure ReceiveCB(Text.s)
PostEvent(#My_Event_NewData,#window_main, 0, 0, AllocateString(Text))
EndProcedure
Procedure zend()
ComData\SendText = GetGadgetText(#str_input)
ComData\SendSignal = 1
EndProcedure
I am confused with the enumerations, sometimes you just use a number, I replace the number with a #name, this seems clearer to me.
I also always use an abbreviation for the type of gadget such as #but_, # window_, # str_ etc so that I know what kind of gadget it is.I don't have much experience.
many thanks for your patience.
Your code works good as it is.
If I replace #CRLF$ by CRLF$ it does not work.
\DataBit = 8
\StopBit = 1
\Handshake = #PB_SerialPort_NoHandshake
\BufferSize = 2048
\EndOfText = #CRLF$ <--------with only CRLF$ it do not work !
\StatusCB = @StatusCB()
\ReceiveCB = @ReceiveCB()
\ThreadID = CreateThread(@thComport(), ComData)
I think only 2 procedures are important for me
Procedure ReceiveCB(Text.s)
PostEvent(#My_Event_NewData,#window_main, 0, 0, AllocateString(Text))
EndProcedure
Procedure zend()
ComData\SendText = GetGadgetText(#str_input)
ComData\SendSignal = 1
EndProcedure
I am confused with the enumerations, sometimes you just use a number, I replace the number with a #name, this seems clearer to me.
I also always use an abbreviation for the type of gadget such as #but_, # window_, # str_ etc so that I know what kind of gadget it is.I don't have much experience.