borge
Junior Member level 1
- Joined
- Jan 4, 2013
- Messages
- 16
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Location
- Norway
- Activity points
- 1,375
Hi
Have been reading up on Pogramming, and starting to understand some basics.
I got a problem when i wanted to add more ports to this easy tutorial.
When i added the _BV(PD5), this was the only led blinking, not both. how do i configure this.
Do i need to define the pins separately ?
I have searched the net, but not any clear answers.
I used Programmers notepad.
Have been reading up on Pogramming, and starting to understand some basics.
I got a problem when i wanted to add more ports to this easy tutorial.
When i added the _BV(PD5), this was the only led blinking, not both. how do i configure this.
Do i need to define the pins separately ?
I have searched the net, but not any clear answers.
I used Programmers notepad.
Code:
#include <avr/interrupt.h>
#define F_CPU 100000UL
#include <util\delay.h>
int main()
{
DDRD = _BV(PD4); // this is the original
DDRD = _BV(PD5); // i added this
while(1) {
PORTD = _BV(PD4);
_delay_ms(1000);
PORTD &= ~_BV(PD4);
_delay_ms(1000);
PORTD = _BV(PD5); // The PD5 i added
_delay_ms(1000);
PORTD &= _BV(PD5);
_delay_ms(1000);
}
return (0);
}