How to send a serial string ending in a carraige return?

Hello,

I have a motorized device that is controlled by serial commands.
Typical text string commands include:

“:G232[0xd]” //Set Motor direction as CCW
“:I2130000[0xd]” //Set Motor Slew Speed
“:J2[0xd]” //Start Motor movement

I am successfully able to serially control the device from an application I have installed on my PC. But I want to be able to control the device via Powershell.

I’ve opened the port this way:
$port= new-Object System.IO.Ports.SerialPort COM4,9600,1,8,1;
$port.open();

All seems to be fine at this point
The commands I’ve tried to write this way:

$port.WriteLine(":K2[char]13");

or this way:
$port.WriteLine(":K2’n");

The device is not responding to any of these.
I’m wondering if my syntax for the carriage return is valid?

Any suggestions would be appreciated

How about trying a CR and LF

Sorry, I am failing to enter the code, the formatting keeps getting lost when I hit submit … bascially,

backTick+r backtick+n

the backtick is under the tilde

 

AH!
Maybe that’s what I had wrong.
I understood the they were single quote r and single quote n
I’ll try that!
Thanks :-]