Mercurial > hg > beaglert
comparison examples/scope_analogue/render.cpp @ 308:1feb9c23ac57 prerelease
Renamed read/write functions to remove the Frame --> e.g. analogWriteFrameOnce -> analogWriteOnce, digitalReadFrame -> digitalRead
author | andrewm |
---|---|
date | Fri, 27 May 2016 18:21:21 +0100 |
parents | e4392164b458 |
children | db2fe4e1b88e |
comparison
equal
deleted
inserted
replaced
307:ff5f346a293e | 308:1feb9c23ac57 |
---|---|
28 { | 28 { |
29 | 29 |
30 for(unsigned int n = 0; n < context->audioFrames; n++) { | 30 for(unsigned int n = 0; n < context->audioFrames; n++) { |
31 | 31 |
32 // read analogIn channels 0 and 1 | 32 // read analogIn channels 0 and 1 |
33 float in1 = analogReadFrame(context, n, 0); | 33 float in1 = analogRead(context, n, 0); |
34 float in2 = analogReadFrame(context, n, 1); | 34 float in2 = analogRead(context, n, 1); |
35 | 35 |
36 // map in1 to amplitude and in2 to frequency | 36 // map in1 to amplitude and in2 to frequency |
37 float amplitude = in1 * 0.8f; | 37 float amplitude = in1 * 0.8f; |
38 float frequency = map(in2, 0, 1, 100, 1000); | 38 float frequency = map(in2, 0, 1, 100, 1000); |
39 | 39 |