My Ultrasonic sensors is not working

The Raspberry Pi is a series of credit card-sized single-board computers developed in the United Kingdom by the Raspberry Pi Foundation to promote the teaching of basic computer science in schools and developing countries.

Post Reply
User avatar
/RaspberryPi
Corporate
Posts: 2449
Joined: Wed Jun 05, 2019 1:29 am

My Ultrasonic sensors is not working

Post by /RaspberryPi »


I have created a python script In which I use gpiozero to set a distance sensor variable and the use 'x.distance' to get the value and then do other things based on that. I have 4 ultrasonic sensors due to lack of pins I use 1 trigger for all 4 of them. I am setting the ultrasonic sensors using 'DistanceSensor(echo = 17, trigger = 4)' then when setting the 2nd sensor it shows error that the trigger pin is already in use due to it being already defined in the first sensor. So how do I proceed in my program without it giving me this error.

P.S I am using 1 trigger pin
submitted by /u/ThorGod267
[link] [comments]

Source: https://www.reddit.com/r/raspberry_pi/c ... t_working/
/RaspberryPi
Post Reply

Return to “Raspberry Pi Forum”