Mercurial > hg > beaglert
comparison 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 |
comparison
equal
deleted
inserted
replaced
374:ecad1ea0382a | 375:768acdeea362 |
---|---|
1 // this example reads the analogue inputs 0 and 1 | 1 /* |
2 // and generates a sine wave with an amplitude and | 2 ____ _____ _ _ |
3 // frequency determined by their values | 3 | __ )| ____| | / \ |
4 // it then plots these on the oscilloscope | 4 | _ \| _| | | / _ \ |
5 | |_) | |___| |___ / ___ \ | |
6 |____/|_____|_____/_/ \_\.io | |
7 | |
8 */ | |
9 | |
10 /** | |
11 \example 3_scope_analog | |
12 | |
13 Connecting potentiometers | |
14 ------------------------- | |
15 | |
16 This example reads from analogue inputs 0 and 1 via `analogReadFrame()` and | |
17 generates a sine wave with amplitude and frequency determined by their values. | |
18 It's best to connect a 10K potentiometer to each of these analog inputs. Far | |
19 left and far right pins of the pot go to 3.3V and GND, the middle should be | |
20 connected to the analog in pins. | |
21 | |
22 The sine wave is then plotted on the oscilloscope. Click the Open Scope button to | |
23 view the results. As you turn the potentiometers you will see the amplitude and | |
24 frequency of the sine wave change. | |
25 | |
26 This project also shows as example of `map()` which allows you to re-scale a number | |
27 from one range to another. Note that `map()` does not constrain your variable | |
28 within the upper and lower limits. If you want to do this use the `constrain()` | |
29 function. | |
30 */ | |
5 | 31 |
6 #include <Bela.h> | 32 #include <Bela.h> |
7 #include <cmath> | 33 #include <cmath> |
8 #include <Scope.h> | 34 #include <Scope.h> |
9 | 35 |