What does PuTTY send when I press Enter key?

Viewed 90573

I am trying desperately to get a Bluetooth dongle working with my Arduino but I can't send it a command that it needs. I can use it when I plug it into my computer via a USB to UART chip and send the command (C) from PuTTY and then press Enter.

The Bluetooth dongle's command sheet says that the command I am trying to send it C<cr> but I can't figure out how to send the proper carriage return character from the Arduino code. I have tried using the Serial.println() function as well as adding the \r character to my current Serial.write("C\r") but neither of those are working.

How can I achieve this?

9 Answers

The modified PuTTY is the easiest solution. If you want to stick with the standard PuTTY, there's some other options... You can send a newline using ctrl+j before pressing enter, but that's a faff. To automate it, you can use AutoHotKey to change your {ENTER} to ^J{ENTER} when you've got a PuTTY window active:

#if WinActive("ahk_exe putty.exe")
    Enter::
        SendInput ^J{Enter}
    Return
#if

To do this for just one PuTTY window, you can give AHK the name of the window:

#if WinActive("COM8 - PuTTY")
    Enter::
        SendInput ^J{Enter}
    Return
#if
Related