user3879: I am trying to compile the function in http://playground.arduino.cc/Code/PwmFrequency
This produces a couple of errors
sketch/setPwmFrequency.c:34:3: error: unknown type name 'byte'
   byte mode;
   ^
sketch/setPwmFrequency.c:45:7: error: 'TCCR0B' undeclared (first use in this function)
       TCCR0B = TCCR0B & 0b11111000 | mode;

byte is trivial, but I can't seem to find TCCR0B et al I assume it should be defined somewhere.

user26916: Both errors can be solved by adding the following line to your setPwmFrequency.c:
#include <Arduino.h>

This will include the files that contain the byte typedef and also the register definitions.
You may notice that is not necessary in an .ino file. The reason is that the Arduino IDE automatically adds the Arduino.h include to .ino files during sketch preprocessing before compilation.

3879: <p>I am trying to compile the function in <a href="http://playground.arduino.cc/Code/PwmFrequency" rel="nofollow noreferrer">http://playground.arduino.cc/Code/PwmFrequency</a></p>

<p>This produces a couple of errors</p>

<pre><code>sketch/setPwmFrequency.c:34:3: error: unknown type name 'byte'
   byte mode;
   ^
sketch/setPwmFrequency.c:45:7: error: 'TCCR0B' undeclared (first use in this function)
       TCCR0B = TCCR0B &amp; 0b11111000 | mode;
</code></pre>

<p><code>byte</code> is trivial, but I can't seem to find <code>TCCR0B</code> et al I assume it should be defined somewhere.</p>
 26916: <p>Both errors can be solved by adding the following line to your setPwmFrequency.c:</p>

<pre class="lang-cpp prettyprint-override"><code>#include &lt;Arduino.h&gt;
</code></pre>

<p>This will include the files that contain the <code>byte</code> typedef and also the register definitions.</p>

<p>You may notice that is not necessary in an .ino file. The reason is that the Arduino IDE automatically adds the Arduino.h include to .ino files during sketch preprocessing before compilation.</p>
