mirror of
https://bitbucket.org/skobkin/arduino_guitar_repeater.git
synced 2024-11-21 20:06:04 +00:00
some tweaks
This commit is contained in:
parent
3def7bd1c8
commit
d1f415638b
16
guitar.ino
16
guitar.ino
|
@ -1,24 +1,24 @@
|
|||
int edge = 15;
|
||||
const long d = 5;
|
||||
int analogInPin = A0;
|
||||
const int edge = 10;
|
||||
const long d = 10;
|
||||
const int analogInPin = A0;
|
||||
const int audioOutPin = 12;
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
//Serial.begin(115200);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
int freq = measureFrequency();
|
||||
long freq = measureFrequency();
|
||||
if (freq != 0)
|
||||
tone(audioOutPin, freq);
|
||||
else
|
||||
noTone(audioOutPin);
|
||||
Serial.println(freq);
|
||||
//Serial.println(freq);
|
||||
}
|
||||
|
||||
int measureFrequency() {
|
||||
long measureFrequency() {
|
||||
long t = millis();
|
||||
int n = 0;
|
||||
long n = 0;
|
||||
boolean o = analogRead(analogInPin) <= edge;
|
||||
|
||||
while(millis() - t <= d)
|
||||
|
|
Loading…
Reference in a new issue