Theremin

Wrote this simple LDR theremin code but was getting error with this one too so please correct me. Thankyou.

int speakerPin = 7;
int ldrPin = 0;
void setup () {
pinMode(speakerPin, OUTPUT);
Serial.begin(9600);
Serial.printIn('ready");
}
void loop() {
  digitalWrite(speakerPin, LOW);
  
  val = analogRead(ldrPin);
  val = val*2;
  
  for( int i=0; i=50; i++ ) {
    digitalWrite(speakerPin, HIGH);
    delayMicroseconds(val);
    digitalWrite(speakerPin, LOW);
    delayMicroseconds(val);
  }
  )
int speakerPin = 7;
int ldrPin = 0;
void setup () {
pinMode(speakerPin, OUTPUT);
Serial.begin(9600);
Serial.println("ready");
}
void loop() {
  digitalWrite(speakerPin, LOW);
  
  int val = analogRead(ldrPin);
  val = val*2;
  
  for( int i=0; i<50; i++ ) {
    digitalWrite(speakerPin, HIGH);
    delayMicroseconds(val);
    digitalWrite(speakerPin, LOW);
    delayMicroseconds(val);
  }
}

You had this line screwed:-
Serial.printIn('ready");
used In not ln and ’ in place of "
val had not been declared before you first used it
the last bracket was a ) and not a }

for( int i=0; i=50; i++ )

Oopsie. http://arduino.cc/en/Reference/For

Oopsie indeed, corrected post now, thanks. :blush:

Thank You. Works :) ;)