Skip to content

Commit 7c7a5c1

Browse files
committed
Merged upstream Arduino master branch
2 parents bc96604 + d4d8f2d commit 7c7a5c1

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

examples/02.Digital/tonePitchFollower/tonePitchFollower.ino

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
* 4.7K resistor on analog 0 to ground
1010
1111
created 21 Jan 2010
12-
modified 9 Apr 2012
13-
by Tom Igoe
12+
modified 31 May 2012
13+
by Tom Igoe, with suggestion from Michael Flynn
1414
1515
This example code is in the public domain.
1616
@@ -29,10 +29,11 @@ void loop() {
2929
int sensorReading = analogRead(A0);
3030
// print the sensor reading so you know its range
3131
Serial.println(sensorReading);
32-
// map the pitch to the range of the analog input.
32+
// map the analog input range (in this case, 400 - 1000 from the photoresistor)
33+
// to the output pitch range (120 - 1500Hz)
3334
// change the minimum and maximum input numbers below
3435
// depending on the range your sensor's giving:
35-
int thisPitch = map(sensorReading, 400, 1000, 100, 1000);
36+
int thisPitch = map(sensorReading, 400, 1000, 120, 1500);
3637

3738
// play the pitch:
3839
tone(9, thisPitch, 10);

0 commit comments

Comments
 (0)