I am trying to perform a bit flip operation on pin 25 of Arduino MEGA (2560) using register level coding. But there is no response from the board. The compiler doesn't reject it either.
Here is the code:
int main()
{
DDRD|=1;
while(1){
PORTD^=(1<<0);
}
}
I used this with setup() and loop() as well, to no avail. However, it works perfectly fine with digitalWrite and pinMode.
Is there something wrong with the code? Or does MEGA not allow this?
In the future, please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.