-
Notifications
You must be signed in to change notification settings - Fork 254
Expand file tree
/
Copy pathPot_Input.cpp
More file actions
45 lines (39 loc) · 1.01 KB
/
Pot_Input.cpp
File metadata and controls
45 lines (39 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "daisy_patch_sm.h"
#include "daisysp.h"
using namespace daisy;
using namespace patch_sm;
using namespace daisysp;
/** Hardware object for the patch_sm */
DaisyPatchSM patch;
int main(void)
{
/** Initialize the patch_sm hardware object */
patch.Init();
/** Loop forever */
while(1)
{
/** Update all cv inputs */
patch.ProcessAllControls();
/** Get CV_1 Input ~(0, 1)
* The values can be slightly outside of that
* range - That means you can get small negative
* values, too!
*/
float value = patch.GetAdcValue(CV_1);
/** Here the pot is wired to GND and 5V
* So 2.5V is the pot's halfway point.
*
* If the Adc value is greater than .5 (2.5V)...
*/
if(value > .5)
{
/** Turn the led on */
patch.SetLed(true);
}
else
{
/** Otherwise, turn the led off */
patch.SetLed(false);
}
}
}