comparison projects/basic_analog_output/render.cpp @ 269:ac8eb07afcf5

Oxygen text added to each render.cpp file for the default projects. Text includes project explanation from Wiki, edited in places. Empty project added as a default project. Doxyfile updated. Each of the project locations added to INPUT configuration option. Consider just watching the whole project file so all new projects are automatically pulled through.
author Robert Jack <robert.h.jack@gmail.com>
date Tue, 17 May 2016 15:40:16 +0100
parents 3c3a1357657d
children 5433c83ce04e
comparison
equal deleted inserted replaced
252:381f352c44eb 269:ac8eb07afcf5
1 /* 1 /*
2 * render.cpp 2 ____ _____ _ _
3 | __ )| ____| | / \
4 | _ \| _| | | / _ \
5 | |_) | |___| |___ / ___ \
6 |____/|_____|_____/_/ \_\.io
7
8 */
9
10 /*
3 * 11 *
4 * Created on: Oct 24, 2014 12 * Andrew McPherson and Victor Zappi
5 * Author: parallels 13 * Queen Mary, University of London
6 */ 14 */
15
16 /**
17 \example 3_analog_output
18
19 Fading LEDs
20 -----------
21
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
24 structure but this time for the analog output channels rather than the audio.
25
26 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
28 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
30 ~4.092V.
31
32 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
34 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
36 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).
38
39 Notice that the phase of the brightness cycle for each led is different. This
40 is achieved by updating a variable that stores a relative phase value. This
41 variable is advanced by pi/4 (1/8 of a full rotation) for each channel giving
42 each of the eight LEDs a different phase.
43
44 */
7 45
8 46
9 #include <BeagleRT.h> 47 #include <BeagleRT.h>
10 #include <Utilities.h> 48 #include <Utilities.h>
11 #include <rtdk.h> 49 #include <rtdk.h>