/*
 * 
 * Simple (PWM) Oscillator!
 * 
 */
#define SPEAKER_PIN 11 

void setup() {
  // set pin 11 as output
  pinMode(SPEAKER_PIN, OUTPUT);
}

void loop() {
  // tone needs output pin and frequency. Here the frequency is determined by reading from analog input 2 (0-1023), or the top potentiometer
  tone(SPEAKER_PIN, analogRead(A2)); 
  delay(100); // a delay adds stability to the tone.
}
