Hello!
I am pretty new to Arduino, and I've been going through a tutorial series on YouTube. One of the lessons was connecting an ultrasonic sensor. I think it would be nice to connect that to a seven-segment display and have that read out distance. Is this possible? I did a bit of searching on seven-segment displays, and I don't really know how I could independently control a display like that using math related to the ultrasonic sensor. I think it would be easier with and LCD, but I'd like to make it with a seven-segment display.
If you can give an overview or example code, please do!
Thanks!!!
Which 7 segment display do you have?
LCDs are more complicated to program than seven segment displays.
Plenty of examples are posted for both, on the web. The details naturally depend on which display you have or choose.
I have a single digit and a four digit seven-segment display. I don't know any module number past that.
Wouldn't an LCD be easier because you can directly print the value? Is there any library or something so that I wouldn't have to individually controll each segment of the display?
If you have a naked 4-digit seven segment display, with lots of pins, then you need an interface module. However there are many seven segment displays that have built in interfaces, which is why we ask.
So what do you have? Post a photo. Image posting guide
Adafruit has a great collection of display types and interface modules.
Even without an image, it seems like the description of the naked display matches. It's just a display with 12 pins. So, I guess the LCD would be easier for me to use given my current situation. Thank you! Does this classify as a [SOLVED]?
Again, I'm prtty new to Arduino, and pretty new to the Arduino forums. ![]()
tyster02:
I don't really know how I could independently control a display like that using math related to the ultrasonic sensor.
If you have what jremington referred to as a "naked" display, that is one of these:
... not one already mounted on a board with a driver built in, then have a look at the 7 segment library.
There's no math (or even maths
) involved: just define the number of digits you have, and print the value ("distance", say) from the sensor. (Same as you would for an lcd.)
12 pins would be the 7 segments+decimal point and four anodes or cathodes. It is possible to drive that using 12 pins on the Arduino, but you need current limiting resistors and usually a driver for the anodes/cathodes, like four transistors or a high power 595 shift register.
A fun and easy project! Simple example
