HC-SR04 analog pin ?

Hi all

Just recieved a couple of HC-SR04 sensors.

I was wondering... Is it possible to run theese on the arduino uno anolog pins ?
Or does it have to be on the digital ?

All examples I can find on the net, they are connected to digital pins.
The problem/clue is, when using the L293 motor shield, the analog pins are all unused.

Best regards
Henrik

I was wondering... Is it possible to run theese on the arduino uno anolog pins ?

Yes. All the analog pins of a standard Arduino can be used a digital I/Os. Most Arduino pins have more than one functionality. For example the pin A4 have three usages: analog input, digital input/output and I2C SDA.

Brilliant. Thank you for the hint :slight_smile:

Henrik_Markussen:
Brilliant. Thank you for the hint :slight_smile:

Also, you can use the NewPing library and control your sensor using only one pin instead of two. This could also save you in a pinch. It's also a VERY good idea to use the NewPing library if you're also using motors, as other ultrasonic libraries or code will give you grief as they don't multitask well (or at all) and cause long 1 second delays.

Tim