나는 블루 베리를 통해 나의 라즈베리 파이와 통신하기 위해 내 ardunio를 얻으려고합니다. 지금은 Minicomm을 사용하여 의사 소통을 할 수있게되었지만 의사 소통에 성공하지 못했습니다. 나는 무수한 것을 시도했지만 그것이 작동하도록 할 수는 없다. 몇 가지 내가 (minicomm 및 기타 물건에서) 확실히 알고 :블루 베리와 라즈베리 파이
이는/dev/rfcomm0- BPS 여기
9600 내 파이
import serial
import time
port="/dev/rfcomm0"
print('hello world')
bluetooth= serial.Serial(port,9600)
print ('hello world 2')
bluetooth.flushInput()
print ('hello world 3')
for i in range(100):
print("we are in the for loop",i)
inputs=bluetooth.readline()
print("we are in the inputs for loop",i)
inputasinteger= int(inputs)
if inputs:
print('we have inputs')
fileb= open("blue.txt",'wU')
fileb.write(inputasInteger*10)
time.sleep(.1)
print('sleeping')
fileb.close()
print('file has been closse')
exit()
01에있는 코드입니다들여 쓰기가 정확하다고 가정 할 수 있습니다 ... 나는 여기에 그들을 고칠 방법을 모르겠습니다. 하지만 내 코드는 라인 입력 = bluetooth.readline();까지 실행됩니다. 그럼 그냥 달려있어 사람이 어떤 경험이 있습니까? 어떤 해결책? 내가 사용할 수있는 다른 모듈에 대해 알고 있습니까?
탭을 공백으로 대체하여 들여 쓰기를 수정 했으므로 시간이 있다면 제대로했는지 다시 확인하십시오. – dsolimano