void setup() {
// Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
//get a sensor reading
int sensorReading = analogRead(A0);
//map the results from the sensor reading’s range to the desired pitch range:
float frequency = map(sensorReading, 0, 1000, 100, 1000);
//change the pitch, play for 10 ms:
tone(8, frequency, 10);
Serial.print(sensorReading);
Serial.print(” , “);
Serial.println(frequency);
delay(10);
}
Detecting the sensor’s range (about 0 to 1000):
Tone sounding out:
Interactivity with sound:
My song:
Jingle:
“Keyboard”:
This one was malfunctioning.
Leave a Reply