2

With the Serial Monitor I have the Newline option:

enter image description here

How can I send the same using python?

I tried:

30\r\n

30\r

30\n

import serial

ser = serial.Serial('COM3', 115200)

while True:
    numIn = input("enter delay value: ")
    ser.write(numIn.encode('ascii'))
2
  • You tried them and they didnt work? ser.write((numIn + '\r').encode())? How are you checking this? Apr 7, 2016 at 0:28
  • Thanks, this (numIn + '\r\n') works. Typing \r\n does not for some reason.
    – clankill3r
    Apr 7, 2016 at 7:35

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.