So i´ve recently started trying to learn coding a microcontroller. I got myself an Arduino ATmega2560.
Im writing in Atmelstudio.
To start with im just trying to turn 2 LED's on and off. I¨ve been able to turn on and of an LED connected to input 4 with the following code:
DDRG |= (0xFF); //setting all G´s as outputs.
PORTG |=(1<<PB5); //setting 4 on board as high, making LED light.
PORTG ^=(1<<PB5); //turning off LED again.
The last line is just put in to turn of the LED again.
If i put in the code:
DDRG |= (0xFF);
PORTG |=(1<<PB5);
PORTG |=(1<<PB2); //should set 3 as high, as far as i can se in the datasheet?
This however dosent seem to work,
I know this is a very basic understanding problem. but it would be much appreciated if anyone could explain this to me.
Im writing in Atmelstudio.
To start with im just trying to turn 2 LED's on and off. I¨ve been able to turn on and of an LED connected to input 4 with the following code:
DDRG |= (0xFF); //setting all G´s as outputs.
PORTG |=(1<<PB5); //setting 4 on board as high, making LED light.
PORTG ^=(1<<PB5); //turning off LED again.
The last line is just put in to turn of the LED again.
If i put in the code:
DDRG |= (0xFF);
PORTG |=(1<<PB5);
PORTG |=(1<<PB2); //should set 3 as high, as far as i can se in the datasheet?
This however dosent seem to work,
I know this is a very basic understanding problem. but it would be much appreciated if anyone could explain this to me.