3. Sketch

The sketch is pretty straightforward:

const int speakerPin = 12;
const int photocellPin = 0;
 
void setup()
{
}
 
void loop()
{
  int reading = analogRead(photocellPin);
  int pitch = 200 + reading / 4;
  tone(speakerPin, pitch);
}

We simply take an analog reading from A0, to measure the light intensity.

We add 200 to this raw value, to make 200 Hz the lowest frequency and simply add the reading divided by 4 to this value, to give us a range around the 440Hz.