Addressing individual digits and segments on the seven segment led display


#1

Hi. Arduino beginner here.

I am trying to figure out how to really use the seven segment led display with my Orion board. Running IDE 1.0.6 on a Win7 machine. I’ve gotten the display to run sample code great, and figured out how to print digits and variables to the display with my own code as well.

What I am trying to figure out now, though, is how to address my code to specific digits (and later, individual segments) of the display. In other words, if I have four digits available on the display (call them d1-d4), and I want to, say, display one variable’s contents on d2, and another variable’s contents on d4, how would I go about doing that?

Thanks for any assistance. This is the most fun I’ve had with hardware in years!


#2

I haven’t tried this yet but here’s my thought:

Looking @https://github.com/Makeblock-official/Makeblock-Library/blob/master/makeblock/examples/Me_7SegmentDisplay/NumberFlow/NumberFlow.ino there’s

disp.display(0,ListDisp[0]);
disp.display(1,ListDisp[1]);
disp.display(2,ListDisp[2]);
disp.display(3,ListDisp[3]);

So my thinking is that function draws each of the 4 segments. I’ll have to play with it and get back to you if I find anything.

Similar example here.https://github.com/Makeblock-official/Makeblock-Library/blob/master/makeblock/examples/Me_7SegmentDisplay/TimeDisplay/TimeDisplay.ino


#3

Shaiss yep, you’re right. Playing around a bit, it seems that defining the variable in the second element of the DISPLAY function as < int8_t > is important. Once I did that, I started being able to feed the contents of that variable to the display.

Here’s the relevant section of code from when I finally got it to work:

disp.display(0,JoystickX); //First element is the address, from 0-3, second is the digit to output
disp.display(2,JoystickY); //First element is uint8_t, second must be int8_t
delay(1000);

I am going to start out getting the display to live display joystick positions with this test sketch.

Eventually, for more granular control, we’ll want to be able to address individual segments of the display, but this is great for now.


#4