Go Down

Topic: What is wrong. Solved. (Read 1 time) previous topic - next topic

naturbot

O I updated the code.

naturbot

#26
Dec 08, 2012, 05:33 am Last Edit: Dec 08, 2012, 05:46 am by naturbot Reason: 1
Thanks for trying to help,  bed time here.  :)

PeterH


O I updated the code.


Suggest you put your updated code in a new post rather than changing the original post, and remember to put it inside [ code ] [/code ] tags so we can read it.
I only provide help via the forum - please do not contact me for private consultancy.

naturbot

Here it is.



Code: [Select]
int sensorPinC = A2;
int sensorPinA = A0;
int sensorPinB = A1;
int sensorPinD = A3;// select the input pin for the potentiometer
int SPEACKER = 4;
int sensorValue = 0;  // variable to store the value coming from the sensor



void setup() { 
  pinMode(SPEACKER, OUTPUT);
 
}
 
  void loop()   
 
{
   
  noTone(4);
 
  sensorValue = analogRead(sensorPinA);
     
    {tone(4, 93, 58);
     while (sensorValue < 500);
     delay (100);}
     
     noTone(4);
     
     sensorValue = analogRead(sensorPinB);
     
   { tone(4, 523, 400);
      while (sensorValue  < 500);
     delay (100);  }
     
     noTone(4);
     
     sensorValue = analogRead(sensorPinC);
     
    {tone(4, 49, 80);
   
 
      while  (sensorValue < 500);
     delay (100);}
     
     noTone(4);
     
     sensorValue = analogRead(sensorPinD);
     
    {tone(4, 104, 139);
      if (sensorValue < 500);
     delay (100);}
     
    }
 

     
     
     
     

AWOL

Code: [Select]
while (sensorValue < 500);
Right there.
Eccentric use of braces loses points.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Go Up