some tweaks

This commit is contained in:
Alexey Skobkin 2013-07-28 07:46:26 +04:00
parent 3def7bd1c8
commit d1f415638b

View file

@ -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)