0

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

  • 1
    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
  • 2
    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

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.