Pages: [1]   Go Down
Author Topic: twinkle led's  (Read 874 times)
0 Members and 1 Guest are viewing this topic.
uk
Offline Offline
Jr. Member
**
Karma: 0
Posts: 61
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

hi all
i know the mega wich i have has got Digital I/O Pins   54 (of which 15 provide PWM output)
can i get all the 54 pins to twinkle an individual led like stars in the sky at night in a random pattern ??
or what would be the better alternative?
« Last Edit: September 16, 2012, 03:18:23 pm by markthespark » Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 180
Posts: 8108
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, you can have each pin twinkle one LED.  Using a higher voltage power source and a transistor for switching you can have each pin twinkle a set of multiple LEDs.  If you spread the members of the set over a wide area it should not be obvious that several are blinking synchronously.

Using multiplexing you can have N pins control (N/2)^2 LEDs (50 pins = 625 LEDs).  You will need N/2 drive transistors.

Using Charlieplexing you can have N pins control N^2-N LEDs (50 pins = 2450 LEDs). You will only be able to light one at a time.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

uk
Offline Offline
Jr. Member
**
Karma: 0
Posts: 61
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

would this sketch be ok once i mod it ?
http://joesgizmos.wordpress.com/2012/07/06/twinkle-leds/


i'm getting in to multiplexing soon
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 180
Posts: 8108
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

would this sketch be ok once i mod it ?
http://joesgizmos.wordpress.com/2012/07/06/twinkle-leds/


i'm getting in to multiplexing soon

If you use an array like:
Code:
const int LED_Pins[] = {2,3,4,5,6,7,8,9,10};

instead of :
Code:
#define LED1 2
#define LED2 3
#define LED3 4
#define LED4 5
#define LED5 6
#define LED6 7
#define LED7 8
#define LED8 9
#define LED9 10

it will be much easier to expand and easier to manipulate LEDs by index.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Pages: [1]   Go Up
Jump to: