Method to change default pin for Rp2040

Question/Issue:
I just saw a tutorial on how to use an ultrasonic sensor on Raspberry Pi Pico with Edge Impulse. I’ll share the tutorial link. Based on the tutorial, the author uses GPIO 16 as the signal output for the ultrasonic sensor. My question is, is that GPIO default, or can we change it?As example i want to use other GPIO.

here’s the link :

Hi @yoshio

Welcome to the forum!

You can change it. Thats Cyrtrons code, we dont typically provide support for others code and you can ask them on the post or share this link with them to respond if you like.

An example of how to change it to pin 18 would be:

Ultrasonic ultrasonic(18);

Hope this helps!

Best

Eoin

Where actually to change the pin are?Is it inside the coding of something or what?Can you share any tutorial link that related to this issue, btw Thank you so much for the response!

1 Like

Hi @yoshio

You can refer to the official documentation provided by in our documentation for the Raspberry Pi RP2040. Here’s the link to get you started:/Raspberry Pi RP2040 | Edge Impulse Documentation

@davidtischler_edgeim do you know if the author of the guide Khor Jia Yong is part of this forum, can we ask for some input here? I cant seem to find them:

Best

Eoin

Yes, you can change the GPIO pin used for the ultrasonic sensor in your Raspberry Pi Pico project with Edge Impulse. In the tutorial you mentioned, GPIO 16 was used as the default pin for the sensor’s signal output. However, you have the flexibility to choose a different GPIO pin according to your needs.

To change the GPIO pin for the ultrasonic sensor, you’ll need to modify the code where the sensor is initialized. Typically, this involves specifying the desired pin number when creating an instance of the Ultrasonic class or whichever sensor class you are using.

For example, if you want to use GPIO 18 instead, you would modify the initialization code to something like this:

Ultrasonic ultrasonic(18);

This line of code instructs the program to use GPIO 18 for the ultrasonic sensor, changing from pin 16 as you had asked.

Hope this helps @yoshio

If not, please let me know, and we will try to clarify further.

Best regards,

Eoin

Oh, that looks like a really cool project the author posted, but I am not familiar with his work. Perhaps see if you can locate him via social media @yoshio ?