diff examples/basic_button/render.cpp @ 372:db2fe4e1b88e prerelease

Doxygen content added to each example render.cpp. References to AnalogReadFrame etc. removed from doxygen content.
author Robert Jack <robert.h.jack@gmail.com>
date Thu, 09 Jun 2016 18:16:05 +0100
parents 02c4ca0e3718
children 9dc5a0ccad25
line wrap: on
line diff
--- a/examples/basic_button/render.cpp	Thu Jun 09 17:31:44 2016 +0100
+++ b/examples/basic_button/render.cpp	Thu Jun 09 18:16:05 2016 +0100
@@ -1,9 +1,42 @@
+/*
+ ____  _____ _        _    
+| __ )| ____| |      / \   
+|  _ \|  _| | |     / _ \  
+| |_) | |___| |___ / ___ \ 
+|____/|_____|_____/_/   \_\.io
+
+ */
+
 /*
  *
  * Andrew McPherson and Victor Zappi
  * Queen Mary, University of London
  */
 
+/**
+\example 2_digital_button
+
+Switching an LED on and off
+---------------------------
+
+This example brings together digital input and digital output. The program will read 
+a button and turn the LED on and off according to the state of the button.
+
+- connect an LED in series with a 470ohm resistor between P8_07 and ground.
+- connect a 1k resistor to P9_03 (+3.3V),
+- connect the other end of the resistor to both a button and P8_08
+- connect the other end of the button to ground.
+
+You will notice that the LED will normally stay on and will turn off as long as 
+the button is pressed. This is due to the fact that the LED is set to the same 
+value read at input P8_08. When the button is not pressed, P8_08 is `HIGH` and so 
+P8_07 is set to `HIGH` as well, so that the LED conducts and emits light. When 
+the button is pressed, P8_08 goes `LOW` and P8_07 is set to `LOW`, turning off the LED.
+
+As an exercise try and change the code so that the LED only turns on when 
+the button is pressed.
+*/
+
 #include <Bela.h>
 #include <Utilities.h>
 #include <cmath>