comparison projects/basic_button/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 da5ce9876fcc
children 5433c83ce04e
comparison
equal deleted inserted replaced
252:381f352c44eb 269:ac8eb07afcf5
1 /*
2 ____ _____ _ _
3 | __ )| ____| | / \
4 | _ \| _| | | / _ \
5 | |_) | |___| |___ / ___ \
6 |____/|_____|_____/_/ \_\.io
7
8 */
9
1 /* 10 /*
2 * 11 *
3 * Andrew McPherson and Victor Zappi 12 * Andrew McPherson and Victor Zappi
4 * Queen Mary, University of London 13 * Queen Mary, University of London
5 */ 14 */
15
16 /**
17 \example 2_digital_button
18
19 Switching an LED on and off
20 ---------------------------
21
22 This sketch brings together digital out with digital in. The program will read
23 a button and turn the LED on and off according to the state of the button.
24
25 - connect an LED in series with a 470ohm resistor between P8_07 and ground.
26 - connect a 1k resistor to P9_03 (+3.3V),
27 - connect the other end of the resistor to both a button and P8_08
28 - connect the other end of the button to ground.
29
30 You will notice that the LED will normally stay on and will turn off as long as
31 the button is pressed. This is due to the fact that the LED is set to the same
32 value read at input P8_08. When the button is not pressed, P8_08 is `HIGH` and so
33 P8_07 is set to `HIGH` as well, so that the LED conducts and emits light. When
34 the button is pressed, P8_08 goes `LOW` and P8_07 is set to `LOW`, turning off the LED.
35
36 As an exercise try and change the code so that the LED only turns on when
37 the button is pressed
38 */
39
6 40
7 #include <BeagleRT.h> 41 #include <BeagleRT.h>
8 #include <Utilities.h> 42 #include <Utilities.h>
9 #include <cmath> 43 #include <cmath>
10 #include <rtdk.h> 44 #include <rtdk.h>