Pages: [1] 2   Go Down
Author Topic: how to work with SevSeg.h ?  (Read 1385 times)
0 Members and 1 Guest are viewing this topic.
Lebanon
Offline Offline
God Member
*****
Karma: 0
Posts: 754
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hello guys,
after i finally found the library i need please to know if there is any tutorial on this site or else on how to work with it ?

here is a picture of the datasheet in the attachment files


* 1.jpg (28.22 KB, 640x480 - viewed 22 times.)

* 2.jpg (33.45 KB, 640x480 - viewed 27 times.)
« Last Edit: July 10, 2013, 04:28:39 am by firashelou » Logged

Aiming for the unreachable !

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 25
Posts: 4108
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hello guys,
after i finally found the library i need please to know if there is any tutorial on this site or else on how to work with it ?
If we could find it we might be able to offer some suggestions.  Perhaps you could tell us where you found it.  We wouldn't want to give you information about a different library by mistake.

Don
Logged

Lebanon
Offline Offline
God Member
*****
Karma: 0
Posts: 754
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hello guys,
after i finally found the library i need please to know if there is any tutorial on this site or else on how to work with it ?
If we could find it we might be able to offer some suggestions.  Perhaps you could tell us where you found it.  We wouldn't want to give you information about a different library by mistake.

Don

i found it here on this site someone has shared this link that leads to it :

https://docs.google.com/file/d/0Bwrp4uluZCpNdE9oWTY0M3BncTA/edit
Logged

Aiming for the unreachable !

Lebanon
Offline Offline
God Member
*****
Karma: 0
Posts: 754
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i made my own kind of library, and i found out that the right should be coded before the left, but don't know why it wasn't working before !!
but only the zeroes are working !!

these are the codes

Code:
void setup(){
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
}

void loop(){
  //0
  digitalWrite(2, HIGH);
  digitalWrite(3, HIGH);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  digitalWrite(6, HIGH); //pin 6 of arduino is connected  to pin 5 of the display LOW for 1 digit and HIGH with pin 10 for 2 digits
  digitalWrite(7, LOW);
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, LOW); // pin 11 of arduino is connected to pin 10 of the display HIGH for 1 digit
 
  digitalWrite(2, HIGH);
  digitalWrite(3, HIGH);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  digitalWrite(6, LOW); //pin 6 of arduino is connected  to pin 5 of the display LOW for 1 digit and HIGH with pin 10 for 2 digits
  digitalWrite(7, LOW);
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, HIGH); // pin 11 of arduino is connected to pin 10 of the display HIGH for 1 digit
 
    delay(1000);
 
  //1
  digitalWrite(2, HIGH);
  digitalWrite(3, HIGH);
  digitalWrite(4, HIGH);
  digitalWrite(5, HIGH);
  digitalWrite(6, LOW);//pin 6 of arduino is connected  to pin 5 of the display LOW for 1 digit and HIGH with pin 10 for 2 digits
  digitalWrite(7, HIGH);
  digitalWrite(8, HIGH);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, LOW); // pin 11 of arduino is connected to pin 10 of the display HIGH for 1 digit
 
  digitalWrite(2, HIGH);
  digitalWrite(3, HIGH);
  digitalWrite(4, HIGH);
  digitalWrite(5, HIGH);
  digitalWrite(6, LOW);//pin 6 of arduino is connected  to pin 5 of the display LOW for 1 digit and HIGH with pin 10 for 2 digits
  digitalWrite(7, HIGH);
  digitalWrite(8, HIGH);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, HIGH); // pin 11 of arduino is connected to pin 10 of the display HIGH for 1 digit
 
  delay(1000);
 
  //0
  digitalWrite(2, HIGH);
  digitalWrite(3, HIGH);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  digitalWrite(6, HIGH); //pin 6 of arduino is connected  to pin 5 of the display LOW for 1 digit and HIGH with pin 10 for 2 digits
  digitalWrite(7, LOW);
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, LOW); // pin 11 of arduino is connected to pin 10 of the display HIGH for 1 digit
 
  digitalWrite(2, HIGH);
  digitalWrite(3, HIGH);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  digitalWrite(6, LOW); //pin 6 of arduino is connected  to pin 5 of the display LOW for 1 digit and HIGH with pin 10 for 2 digits
  digitalWrite(7, LOW);
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, HIGH); // pin 11 of arduino is connected to pin 10 of the display HIGH for 1 digit
 
  delay(1000);
}
« Last Edit: July 09, 2013, 02:38:39 pm by firashelou » Logged

Aiming for the unreachable !

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 25
Posts: 4108
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Connect the four digit pins with four limiting resistors in series to any digital or analog pins.

AARRGGHH.
I stopped reading at this point.  If he can't get this part right I don't have much confidence in the rest of what he says.  The resistors (eight of them) go in series with the segment pins.


Don
 
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 25
Posts: 4108
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Your code cannot be evaluated without knowing what each pin of the Arduino is doing.  A simple way of doing this is by adding comments to these statements:

Code:
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);


As far as this part is concerned, whatever you are trying to accomplish in the first half will be immediately overwritten by whatever you are trying to accomplish in the second half.


Code:
  //0
  digitalWrite(2, HIGH);
  digitalWrite(3, HIGH);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  digitalWrite(6, HIGH); //pin 6 of arduino is connected  to pin 5 of the display LOW for 1 digit and HIGH with pin 10 for 2 digits
  digitalWrite(7, LOW);
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, LOW); // pin 11 of arduino is connected to pin 10 of the display HIGH for 1 digit
 
  digitalWrite(2, HIGH);
  digitalWrite(3, HIGH);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  digitalWrite(6, LOW); //pin 6 of arduino is connected  to pin 5 of the display LOW for 1 digit and HIGH with pin 10 for 2 digits
  digitalWrite(7, LOW);
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, HIGH); // pin 11 of arduino is connected to pin 10 of the display HIGH for 1 digit
 
    delay(1000);

Don
Logged

Lebanon
Offline Offline
God Member
*****
Karma: 0
Posts: 754
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Your code cannot be evaluated without knowing what each pin of the Arduino is doing.  A simple way of doing this is by adding comments to these statements:

Code:
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);


As far as this part is concerned, whatever you are trying to accomplish in the first half will be immediately overwritten by whatever you are trying to accomplish in the second half.


Code:
  //0
  digitalWrite(2, HIGH);
  digitalWrite(3, HIGH);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  digitalWrite(6, HIGH); //pin 6 of arduino is connected  to pin 5 of the display LOW for 1 digit and HIGH with pin 10 for 2 digits
  digitalWrite(7, LOW);
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, LOW); // pin 11 of arduino is connected to pin 10 of the display HIGH for 1 digit
 
  digitalWrite(2, HIGH);
  digitalWrite(3, HIGH);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  digitalWrite(6, LOW); //pin 6 of arduino is connected  to pin 5 of the display LOW for 1 digit and HIGH with pin 10 for 2 digits
  digitalWrite(7, LOW);
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, HIGH); // pin 11 of arduino is connected to pin 10 of the display HIGH for 1 digit
 
    delay(1000);

Don

yes your right, but i saw in a tutorial or i heard the guy saying we will light up every single digit by it's own which will look like it is lighting in the same time so i tried that then i noticed it can't work, but i need to know how to make it work then ? :S
Logged

Aiming for the unreachable !

Lebanon
Offline Offline
God Member
*****
Karma: 0
Posts: 754
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
[quote author=floresta link=topic=176502.msg1310181#msg1310181 date=1373408887]
[color=black]Your code cannot be evaluated without knowing what each pin of the Arduino is doing.  A simple way of doing this is by adding comments to these statements:[/color]

[code]  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);

about this part well, all the pins of the display are connected to the arduino as u can see in this part of codes[/code]
Logged

Aiming for the unreachable !

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 25
Posts: 4108
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
... but i need to know how to make it work then ?
In order to give you any help here I have to know what you are trying to do.

What does Arduino pin 3 control (what is it connected to)?

What does Arduino pin 4 control (what is it connected to)?

Same question for the rest of the pins ...

What are the ten statements in the first part of ' //0 ' attempting to accomplish?

What are the ten statements in the second part of ' //0 ' attempting to accomplish?

What is the purpose of the delay after the second group of ten statements?

Why is there no delay after the first group of ten statements?


Don
Logged

Lebanon
Offline Offline
God Member
*****
Karma: 0
Posts: 754
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
... but i need to know how to make it work then ?
In order to give you any help here I have to know what you are trying to do.

What does Arduino pin 3 control (what is it connected to)?

What does Arduino pin 4 control (what is it connected to)?

Same question for the rest of the pins ...

What are the ten statements in the first part of ' //0 ' attempting to accomplish?

What are the ten statements in the second part of ' //0 ' attempting to accomplish?

What is the purpose of the delay after the second group of ten statements?

Why is there no delay after the first group of ten statements?


Don

ok what I am trying to do is counting 00, 01, 00, 01, 00 and so on so the pin number 1 of the display is connected to pin 2 of the arduino and so on till pin 10 or display, I added pictures for the datasheet
« Last Edit: July 10, 2013, 04:29:16 am by firashelou » Logged

Aiming for the unreachable !

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 25
Posts: 4108
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
ok what I am trying to do is counting 00, 01, 00, 01, 00 and so on
OK.  If your //0 and //1 comments had been //00 and //01 we may have been able to figure this out and this would have verified that you were dealing with a two-digit seven-segment display which I suspected when I formulated my questions.

Quote
so the pin number 1 of the display is connected to pin 2 of the arduino and so on till pin 10 or display,
But we still don't know what pin number 1 of the display does ... and so on.

Quote
I added pictures for the datasheet
I don't see any pictures here.  It looks like you may have added them to your earlier posts which accomplishes two things:
(1) It almost guarantees that anyone that has been participating in this thread will overlook them since they do not reread the entire thread each time there is a new post.
(2) It almost guarantees that anyone stumbling on the thread for the first time will have a hard time following the thread because the answers to the earlier posts are based on material that has changed since the answer was written.


Since you have a two digit display you have to understand that you are dealing with multiplexing.  This essentially means that only one of the digits is ever on at a given instant in time.  So, you should read up on multiplexing, go back and answer each of the questions in my previous post, and then see if you can restructure your program code.  I suggest that you initially concentrate on just displaying a single pair of numbers.  

Here is an outline of what has to be done (I can't be more specific about the logic levels since I don't know if you have a common anode or a common cathode display):
Set up the logic levels on the common elements to deactivate both digits.
Set up the proper levels for each of the segments of the left hand digit.
Set up the logic levels on the common elements to activate the left hand digit and deactivate the right hand digit.
Delay for a fraction of a second.
Set up the logic levels on the common elements to deactivate both digits.
Set up the proper levels for each of the segments of the right hand digit.
Set up the logic levels on the common elements to activate the right hand digit and deactivate the lefthand digit.
Delay for a fraction of a second.
Repeat


Don
Logged

Lebanon
Offline Offline
God Member
*****
Karma: 0
Posts: 754
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
ok what I am trying to do is counting 00, 01, 00, 01, 00 and so on
OK.  If your //0 and //1 comments had been //00 and //01 we may have been able to figure this out and this would have verified that you were dealing with a two-digit seven-segment display which I suspected when I formulated my questions.

Quote
so the pin number 1 of the display is connected to pin 2 of the arduino and so on till pin 10 or display,
But we still don't know what pin number 1 of the display does ... and so on.

Quote
I added pictures for the datasheet
I don't see any pictures here.  It looks like you may have added them to your earlier posts which accomplishes two things:
(1) It almost guarantees that anyone that has been participating in this thread will overlook them since they do not reread the entire thread each time there is a new post.
(2) It almost guarantees that anyone stumbling on the thread for the first time will have a hard time following the thread because the answers to the earlier posts are based on material that has changed since the answer was written.


Since you have a two digit display you have to understand that you are dealing with multiplexing.  This essentially means that only one of the digits is ever on at a given instant in time.  So, you should read up on multiplexing, go back and answer each of the questions in my previous post, and then see if you can restructure your program code.  I suggest that you initially concentrate on just displaying a single pair of numbers.  

Here is an outline of what has to be done (I can't be more specific about the logic levels since I don't know if you have a common anode or a common cathode display):
Set up the logic levels on the common elements to deactivate both digits.
Set up the proper levels for each of the segments of the left hand digit.
Set up the logic levels on the common elements to activate the left hand digit and deactivate the right hand digit.
Delay for a fraction of a second.
Set up the logic levels on the common elements to deactivate both digits.
Set up the proper levels for each of the segments of the right hand digit.
Set up the logic levels on the common elements to activate the right hand digit and deactivate the lefthand digit.
Delay for a fraction of a second.
Repeat


Don


sorry it's my fault about info i thought i added the "library": well it's a CA display, and about my comments as you can see in the library my comment in the codes down there in the attachement file, and about the list you said i did those steps but i reached a place where when i activate both digits i will have the same number on both, i couldn't figure out how to activate both digits with a different number like 01 02 ... all i had is 0 left or 0 right, 1 left or 1 right etc :

* _2_digit_set_up.ino (11.77 KB - downloaded 9 times.)
« Last Edit: July 10, 2013, 09:58:28 am by firashelou » Logged

Aiming for the unreachable !

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 25
Posts: 4108
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OK - we will do it the hard way.  This is going to take a long time.

What is the function of pin 1 on your display?


Don
Logged

Lebanon
Offline Offline
God Member
*****
Karma: 0
Posts: 754
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't understand what do you mean which function?
pin1 is connected to pin 2 on arduino and I always turn it off because it's for the point
« Last Edit: July 10, 2013, 02:22:53 pm by firashelou » Logged

Aiming for the unreachable !

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 25
Posts: 4108
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
...pin1 is connected to pin 2 on arduino and I always turn it off because it's for the point
Ah ha - pin 1 of the display is connected to the decimal point.

Code:
  pinMode(2, OUTPUT);         // LED decimal point
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
. . .
 
and

Code:
  //0
  digitalWrite(2, HIGH);         // decimal point OFF
  digitalWrite(3, HIGH);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
. . .

Your turn.

Don
Logged

Pages: [1] 2   Go Up
Jump to: