아래 코드를 실행할 때마다 다음과 같은 오류가 발생합니다.
ImportError : 'serial'(알 수없는 위치)에서 'Serial'이름을 가져올 수 없습니다.
암호:
from serial import Serial
arduinodata = Serial('com4',9600)
print("Enter n to ON LED and f to OFF LED")
while 1:
input_data = raw_input()
print ("You Entered"+input_data)
if (input_data == 'n'):
arduinodata.write(b'1')
print("LED ON")
if (input_data == 'f'):
arduinodata.write(b'0')
print("LED OFF")
필요한 모든 파이썬 모듈을 설치했습니다. pyserial, pyfirmata 등과 비슷하지만 지속적으로 오류가 발생합니다.
대부분 누락 된
__init__.py
파일 또는 모듈, 또는 모듈 (Serial)의 파일 하위 디렉토리가 파일 실행 파일과 다른 계층에 있습니다. 도움이되기를 바랍니다 :).
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다