Can I use one digital pin port to use two trigger pins?

Hi, I am making a car with Arduino Uno, and I am working on to use the ultrasonic sensor to detect obstacles. Because I have only three digital pins left but I have to use two ultrasonic sensors, I decided to use two trigger pins in one digital pin. Is it possible to do like this? If I can't, how can I use two sensors requiring 4 digital pins total?

#define Trigger_L 11   
#define Echo_L 8      
#define Trigger_R 11  
#define Echo_R 12     

Welcome to the forum

Which Arduino board are you using ?
Have you used all of the analogue in pins ?

I am using Arduino Uno with a sensor shield on it. Can I use analogue pins instead of digital pins?

You can use analogue pins as digital pins. Just treat them as normal using pinMode(), digitalWrite(), digitalRead() etc

Thanks, I will try it!

Yes you can, as UKHeliBob has already said.

And to prove it, the Arduino Uno uses pins A4 and A5 as digital pins for I2C communications.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.