Skip to content

Commit 2db1b1d

Browse files
authored
Add files via upload
1 parent cbfee60 commit 2db1b1d

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#include <Streaming.h>
2+
#include <StopWatch.h>
3+
#include <Albert.h>
4+
#include <avdweb_AnalogReadFast.h>
5+
6+
const byte adcPin = A1;
7+
8+
void setup(void)
9+
{ Serial.begin(9600);
10+
while(!Serial);
11+
Serial << "\nanalogRead_10bit us1 analogReadFast_10bit us3";
12+
for(int i=0; i<10; i++) testAnalogRead();
13+
}
14+
15+
void testAnalogRead()
16+
{ static Stopwatch stopwatch(micros);
17+
//delay(1000);
18+
19+
stopwatch.start();
20+
int adc1 = analogRead(adcPin); // only resolution 10bit 112us on AVR
21+
stopwatch.stop(); int t1 = stopwatch.interval;
22+
23+
stopwatch.start();
24+
int adc2 = analogReadFast(adcPin); // 20us on AVR
25+
stopwatch.stop(); int t2 = stopwatch.interval;
26+
27+
Serial << endl << adc1, t1, adc2, t2;
28+
}
29+
30+
void loop(void)
31+
{
32+
}
33+
34+
35+

0 commit comments

Comments
 (0)