We would like to build a community for Small Basic programmers of any age who like to code. Everyone from total beginner to guru is welcome. Click here to register and share your programming journey!


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
LDCommPort
#7
Hi Eddie,
I don't know if your DCC-EX central unit is an Arduino application or some other hardware.
The following COM checker should be able to find the Arduino.
If COM5 won't open, another program might have reserved it, so close it first.
I don't know if CR and LF are necessary, so maybe comment them out.


Code:
ArduinoCommand = "<s>"
ports = LDCommPort.AvailablePorts()
TextWindow.WriteLine(ports)
numberPorts = Array.GetItemCount(ports)
TextWindow.WriteLine(numberPorts)
For n = 1 to numberPorts
  TextWindow.WriteLine("Open " + Ports[n])
  result = LDCommPort.OpenPort(ports[n],115200)
  TextWindow.WriteLine(result)
  Program.Delay(100)
  TextWindow.WriteLine("Send " + ArduinoCommand)
  result = LDCommPort.TXString(ArduinoCommand)
  result = LDCommPort.TXByte(13) 'Send carriage return'
  result = LDCommPort.TXByte(10) 'Send linefeed'
  TextWindow.WriteLine(result) 
  Program.Delay(100)
  TextWindow.WriteLine("Read  " + ports[n])
  result = LDCommPort.RXAll()
  TextWindow.WriteLine(result)
EndFor
Reply


Messages In This Thread
LDCommPort - by Eddie - 07-13-2025, 05:56 AM
RE: LDCommPort - by litdev - 07-13-2025, 07:28 AM
RE: LDCommPort - by Eddie - 07-13-2025, 09:18 AM
RE: LDCommPort - by litdev - 07-13-2025, 10:19 AM
RE: LDCommPort - by Eddie - 07-13-2025, 12:21 PM
RE: LDCommPort - by litdev - 07-13-2025, 12:49 PM
RE: LDCommPort - by Scout - 07-13-2025, 05:14 PM
RE: LDCommPort - by AbsoluteBeginner - 07-13-2025, 07:06 PM
RE: LDCommPort - by Eddie - 07-14-2025, 01:22 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)