1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-30 16:24:09 +03:00

Merged upstream Arduino master branch

This commit is contained in:
Cristian Maglie
2012-06-26 00:51:35 +02:00
21 changed files with 176 additions and 134 deletions

View File

@ -9,8 +9,8 @@
* 4.7K resistor on analog 0 to ground
created 21 Jan 2010
modified 9 Apr 2012
by Tom Igoe
modified 31 May 2012
by Tom Igoe, with suggestion from Michael Flynn
This example code is in the public domain.
@ -29,10 +29,11 @@ void loop() {
int sensorReading = analogRead(A0);
// print the sensor reading so you know its range
Serial.println(sensorReading);
// map the pitch to the range of the analog input.
// map the analog input range (in this case, 400 - 1000 from the photoresistor)
// to the output pitch range (120 - 1500Hz)
// change the minimum and maximum input numbers below
// depending on the range your sensor's giving:
int thisPitch = map(sensorReading, 400, 1000, 100, 1000);
int thisPitch = map(sensorReading, 400, 1000, 120, 1500);
// play the pitch:
tone(9, thisPitch, 10);