Thermin

/*
Original idea from Adafruit Arduino – Lesson 10. Pseudo Thermin
https://learn.adafruit.com/adafruit-arduino-lesson-10-making-sounds/arduino-code
*/

#include

int reading; // store light sensor reading
const int minPitch = 200;
const int maxPitch = 6000;

void setup()
{
Serial.begin(9600);
CircuitPlayground.begin();
}

void loop()
{
// read the light sensor
reading = CircuitPlayground.lightSensor();

// calculate a pitch based on the light sensor
int pitch = map(reading, 0, 1023, minPitch, maxPitch);

// play a tone
CircuitPlayground.playTone(pitch, 100, false);
Serial.println(pitch);
}