user45082: I would like to generate square signal up to 8 MHz using internal timer of arduino, I have done successfully in pin 11, but i want to change it in pin 3, but still stuck. Here is the code
 pinMode(11,OUTPUT);

 TCCR2A = ((1 << WGM21) | (1 << COM2A0));
 TCCR2B = (1 << CS20); // prescaler = 1
 TIMSK2 = 0;
 OCR2A = 1;

from this page here 
How can i change the pin to pin 3?
Thank you

user13432: The MCU Timer Outputs are hardwired to specific pins. Arduino Nano (ATmega328p) pin 3 is the MCU pin PD3 and may be connected to Timer 2 output logic, OC2B with Output Compare Register 2B (OCR2B). Waveform Generator Mode and Timer Clock prescale are the same as above. 
 pinMode(3,OUTPUT);

 TCCR2A = ((1 << WGM21) | (1 << COM2B0));
 TCCR2B = (1 << CS20); // prescaler = 1
 TIMSK2 = 0;
 OCR2B = 1;

Cheers!

45082: <p>I would like to generate square signal up to 8 MHz using internal timer of arduino, I have done successfully in pin 11, but i want to change it in pin 3, but still stuck. Here is the code</p>

<pre><code> pinMode(11,OUTPUT);

 TCCR2A = ((1 &lt;&lt; WGM21) | (1 &lt;&lt; COM2A0));
 TCCR2B = (1 &lt;&lt; CS20); // prescaler = 1
 TIMSK2 = 0;
 OCR2A = 1;
</code></pre>

<p>from this page <a href="https://forum.arduino.cc/index.php?topic=488449.0" rel="nofollow noreferrer">here</a> 
How can i change the pin to pin 3?</p>

<p>Thank you</p>
 13432: <p>The MCU Timer Outputs are hardwired to specific pins. Arduino Nano (ATmega328p) pin 3 is the MCU pin PD3 and may be connected to Timer 2 output logic, OC2B with Output Compare Register 2B (OCR2B). Waveform Generator Mode and Timer Clock prescale are the same as above. </p>

<pre><code> pinMode(3,OUTPUT);

 TCCR2A = ((1 &lt;&lt; WGM21) | (1 &lt;&lt; COM2B0));
 TCCR2B = (1 &lt;&lt; CS20); // prescaler = 1
 TIMSK2 = 0;
 OCR2B = 1;
</code></pre>

<p>Cheers!</p>
