Theremin code - not working.

Hello,

At the moment I am building a theremin. But I am having some problems with the code. It should be working, and I don’t know what’s wrong. When I try compiling the code I get the error message saying:

“exit status 1
‘ldrBright’ was not declared in this scope”

How can I fix this?

//* theremin

int soundPin = 11;
int pitchInputPin = 0;
int volumeInputPin = 1;
int ldrDim = 400;
int ldeBright = 800;

byte sine = { 0, 22, 44, 64, 82, 98, 111, 120, 126, 127,
126, 120, 111, 98, 82, 64, 44, 22, 0, -22, -44, -64, -82,
-98, -111, -120, -126, -128, -126, -120, -111, -98, -82, -64, -44,
-22 };

long lastCheckTime = millis ();
int pitchDelay;
int Volume;

void setup ()

{
// change PWM frequency to 63 kHz

cli ();
bitSet (TCCR2A, WGM20);
bitSet (TCCR2A, WGM21);
bitSet (TCCR2B, CS20);
bitSet (TCCR2B, CS21);
bitSet (TCCR2B, CS22);
sei ();
pinMode (soundPin, OUTPUT ) ;
}

void loop ()

{

long now = millis ();
if (now > lastCheckTime +20L)

{

pitchDelay = map (analogRead(pitchInputPin), ldrDim, ldrBright, 10, 30);
volume = map (analogRead (volumeInputPin), ldrDim, ldrBright, 1, 4) ;
lastCheckTime = now;

}

playSine (pitchDelay, volume)
}

void playSine (int period, int volume)

{
for ( int i = 0; i < 36; i++)

{
analogWrite (soundPin, (sine / volume) + 128) ;

  • delayMicroseconds (period);*
  • }*
  • }*

(deleted)

Thank you! Such a rookie mistake. It's working now! :slight_smile: