I am writing a code for an ultrasonic distance sensor. The code worked fine when i used the gpio numbering system for the wires connecting to the gpios and sensor. As soon as i connected the sensor to the car for which i have been using pin number for the motors then the sensor stops working. When i change the gpio number of the sensors to the pin number then it works fine again. Can anybody explain it to me why is that happening? This picture shows Pin numbers as well as gpio numbers

New contributor
Muhammad Hassan is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • We can't really answer without seeing your code. However you will presumably be constantly switching between pin numbering modes which is likely to cause problems. – CoderMike Feb 11 at 20:34
  • 1
    so, you originally wrote the code using GPIO numbers, and then connected the sensor to the car for which i have been using pin number ... well as you can see, the GPIO number and pin number are different ... so, if your code uses GPIO3, that's not the same as your car pin3 - clearly, once you've changed your code to use PIN3, that will correspond to the PIN3 of the car (I'm using 3 as an example only of course, since you've shown absolutely nothing about YOUR code, just a generic picture of a pi that provides no information about your problem) – Jaromanda X Feb 11 at 22:15

Your Answer

Muhammad Hassan is a new contributor. Be nice, and check out our Code of Conduct.

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.