// Alexandre Castonguay Distribue sous la GPL. // Prends une lecture d'un senseur et genere une tonalite void setup() { Serial.begin(9600); } void loop() { int valeurCapteur = analogRead(A0); // read the sensor Serial.println(valeurCapteur); // 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 frequence = map(valeurCapteur, 0, 1023, 200, 6000); tone(3, frequence, 1000); // play the pitch: delay(100); // delay in between reads for stability }