Mercurial > hg > beaglert
diff projects/basic_blink/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 | 92145ba7aabf |
children | 5433c83ce04e |
line wrap: on
line diff
--- a/projects/basic_blink/render.cpp Wed May 11 10:29:23 2016 +0100 +++ b/projects/basic_blink/render.cpp Tue May 17 15:40:16 2016 +0100 @@ -1,3 +1,46 @@ +/* + ____ _____ _ _ +| __ )| ____| | / \ +| _ \| _| | | / _ \ +| |_) | |___| |___ / ___ \ +|____/|_____|_____/_/ \_\.io + + */ + +/* + * + * Andrew McPherson and Victor Zappi + * Queen Mary, University of London + */ + +/** +\example 2_digital_blink + +Blinking an LED +--------------- + +This sketch shows the simplest case of digital out. Connect an LED in series with +a 470ohm resistor between P8_07 and ground. The led is blinked on and off by +setting the digital pin `HIGH` and `LOW` every interval seconds (set it in the +`render()` function). + +Firstly the pin mode must be set to output mode: +`pinModeFrame(context, 0, P8_07, OUTPUT);` in the `setup()` function. The output +of the digital pins is set by the following code: +`digitalWriteFrame(context, n, P8_07, status);` where status can be equal to +either `HIGH` or `LOW`. When set `HIGH` the pin will give 3.3V, when set to +`LOW` 0V. + +To keep track of elapsed time we have a sample counter count. When count reaches +a certain limit it switches state to either `HIGH` or `LOW` depending on its current +value. In this case the limit is `context->digitalSampleRate*interval` which +allows us to write the desired interval in seconds, stored in `interval`. +*/ + + + + + #include <BeagleRT.h> #include <Utilities.h> #include <cmath>