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);}
Why did you delete your other post? You are making the same mistakes that you did before. The other post had a ton of feedback on how to fix your code, yet you delete it and start a new thread with the same mistakes...
naturbot:
I thought that adding the other curly bracket would fix it.
Fix what? What problem are you having? The latest code that you edited in compiles fine for me so you're going to have to do more than saying "something is wrong"
If you're getting an error message post it. If the Arduino is not behaving how you want it, tell us how it's behaving and how you want it to behave. I can spot a few common errors in your sketch that won't throw a compiler error but will likely make it not run as desired, but I'm waiting to here what you are trying to do before I give suggestions on how to fix it.
naturbot:
I am using a anolog joystick to try to play different notes but it plays the same note over and over again. and that is the code that I just updated.
That's because of what you put here:
sensorValue = analogRead(sensorPinA);
tone(4, 93, 58);
while (sensorValue < 500);
If the sensorValue is less than 500, then it won't get past that last line of code because you never update sensorValue.
No it is not for playing with the arduino. I just had to get up this morning to clean the house with my sisters.
I won't be back till Friday because I have been grounded from the arduino my parents think it is a distraction from school and chores because it is all I do in my free time.