Maker Pro
Maker Pro

Switch Using Atmega16A

pavankukkala

Mar 25, 2014
78
Joined
Mar 25, 2014
Messages
78
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
Nov 17, 2011
13,738
Joined
Nov 17, 2011
Messages
13,738
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.
 

pavankukkala

Mar 25, 2014
78
Joined
Mar 25, 2014
Messages
78
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
Nov 17, 2011
13,738
Joined
Nov 17, 2011
Messages
13,738
This is not helpful, as the code for one LED works, as you wrote.
Show us the code for more than one LED.
 

Arouse1973

Adam
Dec 18, 2013
5,178
Joined
Dec 18, 2013
Messages
5,178
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