issues with delaying servo from 0 to 45 degrees and vice versa

Can't you see that a condition dependent upon the starting condition of a loop, inside a loop, is totally different to a condition inside a loop that can never be met?

AWOL:
Can't you see that a condition dependent upon the starting condition of a loop, inside a loop, is totally different to a condition inside a loop that can never be met?

Yes I do

Great.
Job done.

AWOL:
Great.
Job done.

Ok so what if I wanted to add when I press a certain button to move in the direction of the loop conditions that I created, how can I go about that?

The great thing about the Arduino is that you can try such things very easily and very quickly, once you've defined exactly what it is you want to do.

thorobred:
Ok so what if I wanted to add when I press a certain button to move in the direction of the loop conditions that I created, how can I go about that?

Rather than ask that question you will get a more helpful answer if you describe the steps that you think are necessary for what you want.

"move in the direction of the loop conditions" doesn't mean anything to me. Move to 90deg or move to 35deg would.

...R

This is what we have been suggesting that you try.

void loop() 
{ 
  for(pos = 52; pos < 90; pos += 1)  // goes from 52 degrees to 90 degrees 
  {                                 // in steps of 1 degree 
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(10);                        // waits 5ms for the servo to reach the position      
  } 

  delay(1000); // Sit around doing nothing for a while.

  for(pos = 52; pos > 0; pos-=1)     // goes from 52 degrees to 0 degrees 
  {                               
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(10);                       // waits 5ms for the servo to reach the position  
  } 

  delay(1000); // Sit around doing nothing for a while.
}

Think about what is going to happen at the end of the first loop, after the delay. The first servo movement is probably not going to be what you want.

delay(10);                        // waits 5ms for the servo to reach the position =(

for(pos = 52; pos < 90; pos += 1)  // goes from 52 degrees to 90 degrees 
  {                                 // in steps of 1 degree 
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(10);                        // waits 5ms for the servo to reach the position      
  }

What is the last value you write to the servo?

Now

for(pos = 52; pos > 0; pos-=1)     // goes from 52 degrees to 0 degrees 
  {                               
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(10);                       // waits 5ms for the servo to reach the position  
  }

What is the first value you write to the servo?

In order for the movement to be correct the last value in the first loop has to be the first value in the second ( or close to it )

AWOL:
The great thing about the Arduino is that you can try such things very easily and very quickly, once you've defined exactly what it is you want to do.

I'm starting to understand that, I was wondering though on an average, how many weeks do you think some who is just getting into arduino can become fairly good at it?

PaulS:
This is what we have been suggesting that you try.

void loop() 

{
  for(pos = 52; pos < 90; pos += 1)  // goes from 52 degrees to 90 degrees
  {                                 // in steps of 1 degree
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(10);                        // waits 5ms for the servo to reach the position     
  }

delay(1000); // Sit around doing nothing for a while.

for(pos = 52; pos > 0; pos-=1)     // goes from 52 degrees to 0 degrees
  {                               
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(10);                       // waits 5ms for the servo to reach the position 
  }

delay(1000); // Sit around doing nothing for a while.
}




Think about what is going to happen at the end of the first loop, after the delay. The first servo movement is probably not going to be what you want.

RIght gotcha, I got the servo to do what I wanted but now I want to try to command it to do something when I press a key.

AWOL:
delay(10);                        // waits 5ms for the servo to reach the position =(

lol it was a typo

thorobred:
I'm starting to understand that, I was wondering though on an average, how many weeks do you think some who is just getting into arduino can become fairly good at it?

If you follow a systematic learning process you should be comfortable with writing simple programs within, say, 20 hours of learning time. (Not counting the time you spend thinking about programming while you are in bed waiting to fall asleep, or after waking up, or while you are commuting).

By systematic I mean that you take one or two of the simple examples that come with the Arduino IDE and study them carefully so that you understand each line. This will probably involve a considerable amount of reading with the assistance of Google and Wikipedia. And a good way to build your understanding is to make a copy of the examples and modify them a little to learn what effect things have.

Then you can take your first steps into making your own programs by using a suitable example as a starting point. The example will set you up with the correct format.

And no matter how expert you become (indeed the more expert you become) you will realize the need to conceive of the most complex project as a series of small pieces each of which should be working before you add more.

...R

And no matter how expert you become (indeed the more expert you become) you will realize the need to conceive of the most complex project as a series of small pieces each of which should be working before you add more.

That can't be reiterated often enough. Write a little code. Test it. Write a little more. Test it. Create functions that consist of nothing but tested code. Test them. Move the tested functions to a library. Test them again. Incremental steps result in working programs far faster than trying to develop all parts of a program all at once.

PaulS:

And no matter how expert you become (indeed the more expert you become) you will realize the need to conceive of the most complex project as a series of small pieces each of which should be working before you add more.

That can't be reiterated often enough. Write a little code. Test it. Write a little more. Test it. Create functions that consist of nothing but tested code. Test them. Move the tested functions to a library. Test them again. Incremental steps result in working programs far faster than trying to develop all parts of a program all at once.

What language is this similar to? Can learning this language help with learn C/C++ easier?

The language is C++ not anything related to it.

thorobred:

PaulS:

And no matter how expert you become (indeed the more expert you become) you will realize the need to conceive of the most complex project as a series of small pieces each of which should be working before you add more.

That can't be reiterated often enough. Write a little code. Test it. Write a little more. Test it. Create functions that consist of nothing but tested code. Test them. Move the tested functions to a library. Test them again. Incremental steps result in working programs far faster than trying to develop all parts of a program all at once.

What language is this similar to? Can learning this language help with learn C/C++ easier?

What do you mean by "this"? It sounds as if you thought the pieces you quoted refer to another programming language. They refer to every programming language. And as @Grumpy_Mike has said the language of the Arduino is C++.

...R