comparison projects/basic_analog_output/render.cpp @ 285:5433c83ce04e Doxy prerelease

Doxygen content added to more project render.cpp files and amended in others.
author Robert Jack <robert.h.jack@gmail.com>
date Tue, 17 May 2016 18:46:55 +0100
parents ac8eb07afcf5
children
comparison
equal deleted inserted replaced
284:7bfb25a2e158 285:5433c83ce04e
21 21
22 This sketch uses a sine wave to drive the brightness of a series of LEDs 22 This sketch uses a sine wave to drive the brightness of a series of LEDs
23 connected to the eight analog out pins. Again you can see the nested `for` loop 23 connected to the eight analog out pins. Again you can see the nested `for` loop
24 structure but this time for the analog output channels rather than the audio. 24 structure but this time for the analog output channels rather than the audio.
25 25
26 Within the first `for` loop in render we cycle through each frame in the analog 26 - connect an LED in series with a 470ohm resistor between each of the analogOut pins and ground.
27
28 Within the first for loop in render we cycle through each frame in the analog
27 output matrix. At each frame we then cycle through the analog output channels 29 output matrix. At each frame we then cycle through the analog output channels
28 with another `for` loop and set the output voltage according to the phase of a 30 with another for loop and set the output voltage according to the phase of a
29 sine tone that acts as an LFO. The analog output pins can provide a voltage of 31 sine tone that acts as an LFO. The analog output pins can provide a voltage of
30 ~4.092V. 32 ~4.092V.
31 33
32 The output on each pin is set with `analogWriteFrame` within the `for` loop that 34 The output on each pin is set with `analogWriteFrame()` within the for loop that
33 cycles through the analog output channels. This needs to be provided with 35 cycles through the analog output channels. This needs to be provided with
34 arguments as follows `analogWriteFrame(context, n, channel, out)`. Channel is 36 arguments as follows `analogWriteFrame(context, n, channel, out)`. Channel is
35 where the you give the address of the analog output pin (in this case we cycle 37 where the you give the address of the analog output pin (in this case we cycle
36 through each pin address in the for loop), out is the variable that holds the 38 through each pin address in the for loop), out is the variable that holds the
37 desired output (in this case set by the sine wave). 39 desired output (in this case set by the sine wave).