私はODROID(Ubuntu 14.04がインストールされたシングルボードコンピュータ)とシリアル通信するためにArduino Nanoを使用しています。 Arduinoのコード:ODROIDでpython-serial OSError:[Errno 11]リソースが一時的に利用できません
void setup() {
Serial.begin(9600); // set the baud rate
Serial.println("Ready"); // print "Ready" once
}
void loop() {
char inByte = ' ';
if(Serial.available()){ // only send data back if data has been sent
char inByte = Serial.read(); // read the incoming data
Serial.println(inByte);
}
delay(100); // delay for 1/10 of a second
}
ザ・Pythonコード:
#!/usr/bin/env python
from time import sleep
import serial
ser = serial.Serial('/dev/LIDAR', 9600, timeout=1) # Establish the connection on a specific port
sleep(1)
print "Arduino is initialized"
counter = 32 # Below 32 everything in ASCII is gibberish
while True:
if (ser.inWaiting()>0):
counter +=1
ser.write(str(chr(counter))) # Convert the decimal number to ASCII then send it to the Arduino
print ser.readline() # Read the newest output from the Arduino
sleep(.1) # Delay for one tenth of a second
if counter == 255:
counter = 32
ser.close
トレースバック(最後の直近):次に
File "./serial_test1.py", line 16, in <module>
print ser.readline() # Read the newest output from the Arduino
File "/usr/lib/python2.7/dis-package/serial/serialposix.py", line 43, in read
buf = os.read(self.fd, size-len(read))
OSError: [Errno 11]Resource temporarily unavailable
は、私は、印刷後にいくつかの値を、この問題を持っていました、私はこの問題が現在の時点で利用可能なデータがないかもしれないことを知っています。しかし、どうすればこの問題を把握できますか?ご協力いただきありがとうございます。
スタックトレース全体を提供してください。 –
こんにちはMr.Eさん、スタックトレースを更新してください。アドバイスをお願いします。どうも – crazymumu