Maker Pro
Maker Pro

Switch Using Atmega16A

Hi friends,
I am making use of the switch to blink a single LED.It is working good
But in my board ,it consists of 8 switches and 8 leds . when I press first switch,first LED have to blink.when I press second switch,second LED have to blink.and so on can anybody give me the code for this program.I have worked on different patterns but only one LED is blinking
 

Harald Kapp

Moderator
Moderator
Instead of requesting the complete code from us, show us your code so we can help you identify the source of the error. This way you can learn something on your way.
 
Note:For single LED
#include <avr/io.h>
int main()
{
DDRA=0x01; // Interfacing LED at PORTA.0
DDRB=0xFE; // Interfacing Switch at PORTB.0
PORTB=0xFF;

saha:
if(PINB==0xFE)
{
PORTA=0x01;
}
else
{
PORTA=0x00;
}
goto saha;
}
 

Harald Kapp

Moderator
Moderator
This is not helpful, as the code for one LED works, as you wrote.
Show us the code for more than one LED.
 
If you want anymore help you need to show us all your code. How do you think we can work out anything fom what you have supplied. Geez, this is hard work pavan.
Adam
 
Top