Mercurial > hg > beaglert
diff examples/scope_analogue/render.cpp @ 375:768acdeea362 prerelease
Merge
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Fri, 10 Jun 2016 00:35:18 +0100 |
parents | db2fe4e1b88e |
children |
line wrap: on
line diff
--- a/examples/scope_analogue/render.cpp Fri Jun 10 00:02:48 2016 +0100 +++ b/examples/scope_analogue/render.cpp Fri Jun 10 00:35:18 2016 +0100 @@ -1,7 +1,33 @@ -// this example reads the analogue inputs 0 and 1 -// and generates a sine wave with an amplitude and -// frequency determined by their values -// it then plots these on the oscilloscope +/* + ____ _____ _ _ +| __ )| ____| | / \ +| _ \| _| | | / _ \ +| |_) | |___| |___ / ___ \ +|____/|_____|_____/_/ \_\.io + + */ + +/** +\example 3_scope_analog + +Connecting potentiometers +------------------------- + +This example reads from analogue inputs 0 and 1 via `analogReadFrame()` and +generates a sine wave with amplitude and frequency determined by their values. +It's best to connect a 10K potentiometer to each of these analog inputs. Far +left and far right pins of the pot go to 3.3V and GND, the middle should be +connected to the analog in pins. + +The sine wave is then plotted on the oscilloscope. Click the Open Scope button to +view the results. As you turn the potentiometers you will see the amplitude and +frequency of the sine wave change. + +This project also shows as example of `map()` which allows you to re-scale a number +from one range to another. Note that `map()` does not constrain your variable +within the upper and lower limits. If you want to do this use the `constrain()` +function. +*/ #include <Bela.h> #include <cmath>