Go Down

Topic: HC-SR04 analog pin ? (Read 2977 times) previous topic - next topic


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


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  :)


Brilliant. Thank you for the hint  :)

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.

My hardware: Arduino, Teensy 2.0, Teensy 3.2 & custom ATmega328 systems
My libraries: NewPing, LCDBitmap, toneAC, toneAC2, NewTone, TimerFreeTone
My projects: http://www.DogBlocker.com/
My beer: Great Lakes Brewing Co. Lake Erie Monster

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131