Hello all
I had a H.W asked to make a 16 LED blink one at a time !!
I already submitted my H.W but using a long way code plus it has some delay at first ??? ....
But before I gave up to that codes I used this one but it wouldn't work ??!!
Just to make things clear ; the question was mostly like:
Regards
I had a H.W asked to make a 16 LED blink one at a time !!
I already submitted my H.W but using a long way code plus it has some delay at first ??? ....
Rich (BB code):
#include <avr/io.h>
//#include <util/delay.h>
void main()
{
DDRA = 0xFF;
DDRB = 0xFF;
unsigned int i;
unsigned int j;
PORTA = 0xFF;
PORTB = 0xFF;
while (1){
for(i=0;i<=7;i++){
switch(i){
case 0:
PORTA = 0xFE;
//_delay_ms(500);
PORTA = 0xFF;
//_delay_ms(500);
break;
.
.
.
.
.
.
Rich (BB code):
#include <avr/io.h>
//#include <util/delay.h>
void main()
{
DDRA = 0xFF;
DDRB = 0xFF;
signed int i;
signed int j;
while (1){
PORTA = 0xFF;
PORTB = 0xFF;
PORTA = PORTA<<1;
//_delay_ms(500);
PORTA = 0xFF;
//_delay_ms(500);
for(i=6;i>1;i--){
PINC = 0x7F>>i
//_delay_ms(500);
PORTA = 0xFF;
//_delay_ms(500);
}
PORTB = PORTB<<1;
//_delay_ms(500);
PORTB = 0xFF;
//_delay_ms(500);
for(j=6;j>1;j--){
PORTB = 0x7F>>j;
//_delay_ms(500);
PORTB = 0xFF;
//_delay_ms(500);
}
}
}
some help please just to know more about it since I am new to this field5. Write a C program for the ATmega 169 ..
Writing a 0 turns on an LED
writing a 1 turns off an LED.
The program should start by turning on/off (Blinking) one led at a time, starting with LED0 and ending with LED15.
This process should repeat indefinitely.
Regards
Last edited: