Skip to main content
deleted 1 character in body
Source Link
goldilocks
  • 60.1k
  • 17
  • 115
  • 230

itsIt's receiving both a return char, and a newline. But you are only checking for the newline.

from time import sleep
import serial
ser = serial.Serial('/dev/ttyAMC0', 9600) # Establish the connection on a specific port
while True:
    print (ser.readline()) # Read the newest output from the Arduino
    IR = (ser.readline())
    if IR == 'FF6897\r\n': #check for carriage return and newline
        print('0')
    else:
        print('shit''wtf')

its receiving both a return char, and a newline. But you are only checking for the newline.

from time import sleep
import serial
ser = serial.Serial('/dev/ttyAMC0', 9600) # Establish the connection on a specific port
while True:
    print (ser.readline()) # Read the newest output from the Arduino
    IR = (ser.readline())
    if IR == 'FF6897\r\n': #check for carriage return and newline
        print('0')
    else:
        print('shit')

It's receiving both a return char, and a newline. But you are only checking for the newline.

from time import sleep
import serial
ser = serial.Serial('/dev/ttyAMC0', 9600) # Establish the connection on a specific port
while True:
    print (ser.readline()) # Read the newest output from the Arduino
    IR = (ser.readline())
    if IR == 'FF6897\r\n': #check for carriage return and newline
        print('0')
    else:
        print('wtf')
Source Link
Chad G
  • 1.1k
  • 1
  • 7
  • 14

its receiving both a return char, and a newline. But you are only checking for the newline.

from time import sleep
import serial
ser = serial.Serial('/dev/ttyAMC0', 9600) # Establish the connection on a specific port
while True:
    print (ser.readline()) # Read the newest output from the Arduino
    IR = (ser.readline())
    if IR == 'FF6897\r\n': #check for carriage return and newline
        print('0')
    else:
        print('shit')