Anonymous

Project:YAAC: Difference between revisions

From London Hackspace Wiki
Line 194: Line 194:
=== PWM ===
=== PWM ===


To get PWM to dim/brighten your LEDs, pick a PWM enabled pin and change the value:
To get PWM to dim/brighten a LED, pick a PWM enabled pin and change the value:


<pre>
<pre>
Line 201: Line 201:
// set to output
// set to output
pinMode(PWM_pin, OUTPUT);
pinMode(PWM_pin, OUTPUT);
// write a compass angle, as an example
// write a varying value to, in this case
// as an example a chose a compass angle,
analogWrite(PWM_pin, angle);
analogWrite(PWM_pin, angle);
</pre>
</pre>
Anonymous user