Forum >The Problem to Connect A02YYUW Rasbperry Pi
RoboticsGeneral

The Problem to Connect A02YYUW Rasbperry Pi

userHead umutcankalkan 2020-01-01 04:23:33 6206 Views4 Replies

I just buy this ultrasonic sensor but sample python code does not work with rasbperry pi 4. 
Model of sensor : A02YYUW
DataSheet : https://pdf.direnc.net/upload/a02yyuw-s ... asheet.pdf
Errors : Traceback (most recent call last):
File "/home/pi/Desktop/DFRobot_RaspberryPi_A02YYUW-master/raspberry/demo_get_distance.py", line 44, in <module>
distance = board.getDistance()
File "/home/pi/Desktop/DFRobot_RaspberryPi_A02YYUW-master/raspberry/DFRobot_RaspberryPi_A02YYUW.py", line 73, in getDistance
self.measure()
File "/home/pi/Desktop/DFRobot_RaspberryPi_A02YYUW-master/raspberry/DFRobot_RaspberryPi_A02YYUW.py", line 41, in measure
while self.ser.inWaiting() == 0:
File "/usr/lib/python3/dist-packages/serial/serialutil.py", line 590, in inWaiting
return self.in_waiting
File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 467, in in_waiting
s = fcntl.ioctl(self.fd, TIOCINQ, TIOCM_zero_str)
OSError: [Errno 25] Inappropriate ioctl for device

2020-08-07 13:25:28 In order to fix this, try using sudo raspi-config, go to Interfacing Options, then Serial, then select No for the login shell and Yes for the serial port hardware to be enabled. Afterwards, reboot. Then adjust the serial port path in DFRobot_RaspberryPi_A02YYUW.py , changing it from /dev/ttyAMA0 to either /dev/serial0 or /dev/serial1. (For the Raspberry Pi Zero W, it was /dev/serial1). userHeadPic patxu
2020-02-25 22:38:01 Hi, i got the same problem as described above, but I don't understand the solution. Can you elaborate? userHeadPic hitman164
2020-01-02 00:05:19 I figure out the problem change file name AMA0 to S0 its start to work. userHeadPic umutcankalkan