Would you like Fries with that?request provide c code for 12 led chaser of suitable pic with fading effect i mean comet tail effect. thank you
#include <pic.h>
#define FADE_RATE 12
#define INITIAL_WIDTH 128
void fade()
{
unsigned char rate = FADE_RATE;
unsigned char pulse_width = INITIAL_WIDTH;
unsigned char count;
while(pulse_width){
PORTB= 0b11111111;
for(count=0; count<pulse_width; count++){
asm("NOP");
}
PORTB=0b00000000;
for(; count; count++){
asm("NOP");
}
if(!rate--){
pulse_width--;
rate = FADE_RATE;
}
}
}
int main(void) {
char b;
TRISB = 0b00000000;
while(1){
for(b=0x02; b; b<<=1){
PORTB = b;
fade(b>>1);
}
for(b=0x40; b; b>>=1){
PORTB = b;
fade(b<<1);
}
}
}
| Thread starter | Similar threads | Forum | Replies | Date |
|---|---|---|---|---|
|
|
Looking for a schematic of a led chaser circuit. | General Electronics Chat | 49 | |
| B | Sequential LED Turn Signals | PCB Layout , EDA & Simulations | 55 | |
| R | Review Request - CD4017BE and NE555P based LED Chaser | PCB Layout , EDA & Simulations | 34 | |
|
|
Incandescent chaser | Digital Design | 21 | |
|
|
How to make a 20 LED chaser with 4017 ? | Digital Design | 83 |