Go Down

Topic: [HOWTO] Write (almost) all you want using a 7 segment displayer (Read 606 times) previous topic - next topic

thuzhen

Hello,
I started to experiment Arduino a few days ago, and yesterday, I was handling a 7 segment displayer. I wanted to write a sentence on it, character after character, but I found it complicated to light a segment after another and to look on the internet what segment I should light to make a character. So I created a simple code (no really clean, but i works) that everyone can easily implement.

It works like that :
Code: [Select]
makeChar(aff, c, 7, cl, on, off);
* aff represent the 7 segment displayer and is an ordered array like aff[] = {A, B, C, D, E, F, G} where A, B, C... corresponds to the pin connected to each segment.
* c is the character to write for example : char c = 'A'
* cl is a boolean that determine if you want to clean what was written on the displayer (if you want to see your characters properly, set it to true)
* on is the state you gotta send on the pin to light the displayer up, you can set it to HIGH or LOW depending how you build your thing
* off is the state you gotta send on the pin to light the displayer off.

Note : you can't use the pin n°0.

Here's the code with an example : http://pastebin.com/mxAUntKu
Here, each thing you type using the serial communication will be displayed on the 7 segment displayer.


Go Up