Skip to content

Commit 5ec2016

Browse files
committed
analogWave: add basic example
1 parent a1545bf commit 5ec2016

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#include "analogWave.h"
2+
3+
analogWave wave(DAC);
4+
5+
int freq = 10; // in hertz, change accordingly
6+
7+
void setup() {
8+
Serial.begin(115200);
9+
pinMode(A0, INPUT);
10+
wave.sine(freq);
11+
}
12+
13+
void loop() {
14+
freq = map(analogRead(A0), 0, 1024, 0, 10000);
15+
Serial.println("Frequency is now " + String(freq) + " hz");
16+
wave.freq(freq);
17+
delay(1000);
18+
}

0 commit comments

Comments
 (0)