Coding serial monitor output to 7 segment display

Hi, I am a student relatively new to coding with Arduinos, and was wondering if anyone could point me in the right direction. I have been working on a project for my engineering class, and in my project, have been pulling numerical accelerometer data from an arduino nano LSM9DS1 IMU through the serial monitor in the Arduino IDE. What I want to do is take that output and display it on a 4 digit 7 segment display. If anyone could help me out with this by showing me how I could go about this -or tell me if this is even possible - that would be greatly appreciated. If there are any examples of this already that I have somehow missed that would be fine too. Thanks.

Tots possible, easy even.

Do you have google where you live?

Try

  Arduino 4 digit 7 segment display

and read for a bit, many times been done.

You'll just out calls to whatever you write where your serial printing is done now.

a7

there are libraries just for this to make your life easy. Looking for "Seven Segment Arduino Library" should get you going.

more info pls. 4 digit 7 segment display - which one?


изображение
изображение

etc...

I would use the HT16K33 - a I2C LED driver or the MAX7219/MAX7221 via SPI.

by the way "scrolling" a number is not very readable. Use more digits to be able to display to full digits. The 8 digit modules are ridiculous cheap anyway.
If you really want to scroll a number it's just a question of multiplications and modulo divisions to show a specific part of the number.

You may follow this tutorial to show your accelerometer data on a 4-digit cc-type multiplexed display unit using SevSeg.h Library.

1. The Schematic
cc4drxy
Figure-1:

2. Test Sketch to show 1234 on the display unit of Fig-1

#include<SevSeg.h>
SevSeg sevSeg;           //create object sevSeg

int numberToShow = 1234;

void setup()
{
 byte segDPins[] = {8, 9, 10, 11, 12, 13, 6, 7};  //DPin8 = seg-a, …, DPin-7 = seg-p
 byte ccDPins[] = {2, 3, 4, 5};          //DPin-2 = cc0, DPin-2 = cc1, ...
 sevSeg.begin(COMMON_CATHODE, 4, ccDPins, segDPins, false, false, false, true);
 sevSeg.setNumber(numberToShow, 0, LOW);
}

void loop()
{
 sevSeg.refreshDisplay();
}

3. To read details on the SevSeg.h Library functions (particularly on showing number with decimal point), you may consult this tutorial.

1 Like

This is the 4 digit 7 segment display I am using

Then interface it with UNO as per post #6 and give a try.

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