Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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'))
share|improve this question
    
You tried them and they didnt work? ser.write((numIn + '\r').encode())? How are you checking this? – TisteAndii Apr 7 at 0:28
    
Thanks, this (numIn + '\r\n') works. Typing \r\n does not for some reason. – clankill3r Apr 7 at 7:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.