Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

16 different LED Patterns with a single switch

Status
Not open for further replies.

Er.abdulrehman

Member level 2
Joined
Jul 18, 2011
Messages
51
Helped
6
Reputation
12
Reaction score
6
Trophy points
1,288
Location
India
Activity points
1,517
How to generate 16 different led patterns with a single switch?

Suggest the logic...


Thanks in advance.
 

Hello!

You are not accurate enough.
What do you mean by LED patterns?
- A single LED that blinks with 16 different patterns (like the tail light of bicycles that you
can by a single press change from OFF / Blink / Continuous?
- A row of LEDs that you want to change with a single press?
- A combination from both?

Dora.
 

ya definitely as mr. doraemon said specify that which kind of pattern you required. only then anyone can understand about yr requirement.
 

8 LEDs connected in a row,the pattern can be both blinking or continuous
 

Hello!

Supposing your LEDs are connected to an output port via a LED driver,
each bit of the port can lit one led. The lighting pattern of your led row can be described
with a single byte. If we represent one lit LED by * and one off led by -, then, for example:
0 -> --------
1 -> -------*
2 -> ------*-
Etc...

You just have to define your led patterns:
Code:
#define NUM_STATES 16

char Pattern[NUM_STATES] = {
     // Enter your predefined patterns
};

Then you create an interrupt function for the button.

And in the interrupt service routine:

Code:
void ButtonISR(void) {
    static uint8 index = 0;
    index++;
    if(index == NUM_STATES) index = 0;
    LedPortOut = Pattern[index];
}

Dora
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top