Loading...
Pages: 1 [2] 3   Go Down
Author Topic: What is wrong. Solved.  (Read 694 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There is no error mesage it complies fine with me too.
Logged

California
Offline Offline
Edison Member
*
Karma: 41
Posts: 1869
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:

Code:
  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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I got to go or my parents will punish me severely.
Logged

California
Offline Offline
Edison Member
*
Karma: 41
Posts: 1869
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I got to go or my parents will punish me severely.

Hopefully it's not for playing around with an Arduino, otherwise it's a bad indication of what society has come to.
« Last Edit: December 01, 2012, 01:35:52 pm by Arrch » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
   
Logged

USA, FL
Offline Offline
God Member
*****
Karma: 12
Posts: 588
A life? Where can I download one of those?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If and when my children (their still young) want to learn about a electronics or programming, then chores can wait.  Learning should be number 1.
Logged

//LiNK

Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am back.
  My dad wants me to learn + He is interested in the projects I make. I am a little behind in school, he just wants me to catch up.
Logged

Anaheim CA.
Offline Offline
Edison Member
*
Karma: 31
Posts: 2310
Experienced old Whitebeard with a Full head of Hair...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

School First, Then Arduino. The education you get will be the single most important thing you can do at this point in your life. It will be the beginnings of your life... So Do It WELL.

Bob
Logged

“The solution of every problem is another problem.” -Johann Wolfgang von Goethe

Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I try to do my school but my mind is never on school always on something else.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Still wont work I tried some changes, it complies fine, but wont work.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

O I updated the code.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for trying to help,  bed time here.  smiley
« Last Edit: December 07, 2012, 11:46:11 pm by naturbot » Logged

UK
Offline Offline
Tesla Member
***
Karma: 89
Posts: 6388
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here it is.



Code:
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);}
     
    }
 

     
     
     
     
Logged

Global Moderator
UK
Online Online
Brattain Member
*****
Karma: 138
Posts: 19067
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
while (sensorValue < 500);
Right there.
Eccentric use of braces loses points.
Logged

Pete, it's a fool looks for logic in the chambers of the human heart.

Pages: 1 [2] 3   Go Up
Print
 
Jump to: