7 segment display - how to create a special character

Morning. I'm new to this so please be gentle!
I have a cricket scoreboard made up of a number of 7 segment displays, controlled by shift registers & an Uno.
I guess that somewhere in the collection of files that I uploaded to the uno is a file that defines which segments are to be illuminated for any given digit that the uno is told to display.
Can someone please tell me which file I might be looking for & how I amend it, as I want to create a special character, basically the top horizontal segment, & the bottom 4, so that it looks like a '10' on its side. I can assign this to any character, say an 'a'
Thanks in advance.

_/O_ Look at that file, no, not that, the next one. There it is.

Here you can read about 7 segments displays and how to control them
http://tronixstuff.com/2010/05/06/getting-started-with-arduino-chapter-five/

I know what sort of string I'm looking for, but how to I view .h or .cpp files?

but how to I view .h or .cpp files?

do you have a text editor?

So you have already got a scoreboard consisting of 7 segment LED displays and an Arduino Uno.
If you post the sketch (program) here that you load onto the Uno, someone may be able to help.
Even better if you also have a schematic (even hand drawn diagram) of all the components (including shift registers involved.

Usually, there is an internal representation of each 7 segment display, consisting of one byte per display.
Each of the eight bits in the byte represents either one of the single segment of the display or the decimal point.

I think the setup gets its definition as to which segments are to be lit from the shifterStr.cpp file.

I think the line
int SegmentArray = {252, 96, 218, 242, 102, 182, 190, 224, 254, 230};
designated the segments for the digits 0-9 in sequence.

I think the value 186 which equates to OxBA gives me the segments I need

I would like to assign the letter a to this value, so that if i send a digit (0-9) it just displays that digit, but if I send an ‘a’ it sends my special character.

Presumably I need to add a line to the ShifterStr file?

Wiring diagram is here https://buildyourownscoreboard.files.wordpress.com/2013/02/circuitdiagram.jpg

ShifterStr.cpp (1.76 KB)

Ok. It looks like you have to make a couple of changes to the library to support a lower case a being used to create a new special character:

Original

int Shifter::display(char* numberToDisplay)
{ // Displays number on display
  int SegmentArray[] = {252, 96, 218, 242, 102, 182, 190, 224, 254, 230};
  int x;
  int res;
  int shiftword;
  
  digitalWrite(_RCKPin, LOW);
  for (x = _NumOfDigits ; x >= 0; x--)
  {
	//check if it is a dash, which means digit off
	if (numberToDisplay[x] == '-'){ 
		//turnoff the digit
  		shiftword = 0; 
	} else {
		//turn the character in to an int
  		res = numberToDisplay[x] - '0';
		//look up the bit pattern to display
  		shiftword = SegmentArray[res];
	}

  	// shift out the bits
  	shiftOut(_SERINPin, _SRCKPin, LSBFIRST, shiftword);
  }
  digitalWrite(_RCKPin, HIGH);
}

New - lower case 'a' sends 186 to shift register

int Shifter::display(char* numberToDisplay)
{ // Displays number on display
  int SegmentArray[] = {252, 96, 218, 242, 102, 182, 190, 224, 254, 230, 186};   //new entry 
  int x;
  int res;
  int shiftword;
  
  digitalWrite(_RCKPin, LOW);
  for (x = _NumOfDigits ; x >= 0; x--)
  {
	//check if it is a dash, which means digit off
	if (numberToDisplay[x] == '-'){ 
		//turnoff the digit
  		shiftword = 0; 
        else if (numberToDisplay[x] == 'a'){ 
            shiftword = SegmentArray[10];    //new entry
        }
	} else {
		//turn the character in to an int
  		res = numberToDisplay[x] - '0';
		//look up the bit pattern to display
  		shiftword = SegmentArray[res];
	}

  	// shift out the bits
  	shiftOut(_SERINPin, _SRCKPin, LSBFIRST, shiftword);
  }
  digitalWrite(_RCKPin, HIGH);
}

Thank you for the reply but I can't seem to make it work.

Whether I use the original shifterStr file, or one with your mods, I get the same display when I send an 'a', which isn't the one defined in the file.

You have to then post your code, not just the library.
You could also try putting your new entry (186) say at position 0 in the array (replacing 252) simply to see if an attempt to output a 0 results in your new character being displayed instead of a 0.

Thank you for trying to help. As I said, I'm very new to this.

If I compile my sketch with the original shifterstr file, it compiles fine.

But if I modify it to add your changes, I get a compile error:

Arduino: 1.6.7 (Windows 7), Board: "Arduino/Genuino Uno"

F:\Program Files\Arduino\libraries\ShifterStr\ShifterStr.cpp: In member function 'int Shifter::display(char*)':

F:\Program Files\Arduino\libraries\ShifterStr\ShifterStr.cpp:56:9: error: expected '}' before 'else'

else if (numberToDisplay == 'a'){

^

F:\Program Files\Arduino\libraries\ShifterStr\ShifterStr.cpp:59:4: error: 'else' without a previous 'if'

} else {

^

F:\Program Files\Arduino\libraries\ShifterStr\ShifterStr.cpp: At global scope:

F:\Program Files\Arduino\libraries\ShifterStr\ShifterStr.cpp:69:15: error: expected constructor, destructor, or type conversion before '(' token

digitalWrite(_RCKPin, HIGH);

^

F:\Program Files\Arduino\libraries\ShifterStr\ShifterStr.cpp:70:1: error: expected declaration before '}' token

}

^

exit status 1
Error compiling.

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.

Please let me know what extra info I have that will enable you to help me.

BTW if I substitute the 96 in the original file for 186, I DO get the character I desire instead of a 1

Found the error. Just a { in the wrong place. Many thanks for your help.

//check if it is a dash, which means digit off
if (numberToDisplay == '-'){
//turnoff the digit
shiftword = 0;
else if (numberToDisplay == 'a'){
shiftword = SegmentArray[10]; //new entry
}
} else {
//turn the character in to an int

Should be

//check if it is a dash, which means digit off
if (numberToDisplay == '-'){
//turnoff the digit
shiftword = 0;
}
else if (numberToDisplay == 'a'){
shiftword = SegmentArray[10]; //new entry
}
else {
//turn the character in to an int

Glad it wall worked out. I was just typing the correction as your post came in.

Thank you very much, appreciate it.

Hi Cartoony,

I'm trying to add a character to my scoreboard using the same coding you got in your thread a couple of years ago.

I've tried using the code however I don't know how to get the webpage/scorer interface to display the letter "a", it will only show 0 to 9. How did you manage to get the webpage and arduino to recognise the "a" input?

@athers185
Above you have a function (method) which will light up segments to display 0 to 9 (entries 0 to 9 in the array) and an 11th entry has been added to recognize the character ‘a’ and go fetch this 11th entry and turn on the relevant segments

This method is general - the way you acquire the data is somewhere else and for you decide/write. What’s your use case?

We have a page set up that displays the digital version of the scoreboard. There are a number of files but I’m assuming the important ones with code are the scoreboard php and index html files?

I’ll see if I can upload them from my laptop for you to view

athers185:
We have a page set up that displays the digital version of the scoreboard. There are a number of files but I'm assuming the important ones with code are the scoreboard php and index html files?

I'll see if I can upload them from my laptop for you to view

This sounds more like an HTML coding question rather than an Arduino coding question although the same principles may apply

It could be a HTML issue but I don't have any real knowledge of either i'm afraid. I've attached the files that I think may be of use.

Basically I want a - to display for target when there is no target set but at present the target is always set at 0 if nothing is set. I want however the target to show as 0 if 0 is input so basically if no target is set (eg the first innings) the digits show a dash. If a target has been set I want the digits to display the figure which would include zero.

Having done a bit of playing it feels like the coding it set to provide a value for zero. if that value is a 0 it will always display a 0 no matter what I try. If I set it to a dash and then set it up so that a zero shows it will show a dash. I don't seem to be able to find a solution where I can set a dash when the system first starts up and then get a zero when I select a zero.

I'll have another go at uploading the docs later the file type isn't supported.

Just to add, I have tested the dash on the serial monitor arduino tester and the dashes were displayed when I enter "a" (and some other characters/letters), it just doesn't work when I use the actual webpage

Post full code...