user25948: Can someone please tell me what I'm doing wrong?
The motor's not turning at all, never mind changing speed.


user27482: It looks like you are attempting to perform hardware PWM on an Analog Input Pin. 
Assuming that you are using an Arduino Uno, try changing your first line of code to use one of the digital output pins which support PWM. You can use any of pins 3, 5, 6, 9, 10, or 11. Then connect that pin to your motor. (Note that you will likely have to use a transistor or driver circuit between the pin and the motor since the motor may well require more current to operate than the Arduino output can directly supply.)
If you are using a different Arduino other than the Uno, look at the documentation to find one of the PWM pins and try using that.

user10794: You should copy and paste the text of the code into your question, not a screenshot of it. Then we can copy and paste the problem lines into the answer.
You are varying up and down the variable motorVoltage in two loops. However you are not then doing an analogWrite with the new value. It should be more like this:
while (motorVoltage <= 255)
  {
  analogWrite (motorPower, motorVoltage);
  motorVoltage++;
  delay (200);
  }


25948: <p>Can someone please tell me what I'm doing wrong?</p>

<p>The motor's not turning at all, never mind changing speed.</p>

<p><a href="https://i.stack.imgur.com/3z9T8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3z9T8.png" alt="enter image description here"></a></p>
 27482: <p>It looks like you are attempting to perform hardware PWM on an Analog Input Pin. </p>

<p>Assuming that you are using an Arduino Uno, try changing your first line of code to use one of the digital output pins which support PWM. You can use any of pins 3, 5, 6, 9, 10, or 11. Then connect that pin to your motor. (Note that you will likely have to use a transistor or driver circuit between the pin and the motor since the motor may well require more current to operate than the Arduino output can directly supply.)</p>

<p>If you are using a different Arduino other than the Uno, look at the documentation to find one of the PWM pins and try using that.</p>
 10794: <p>You should copy and paste the text of the code into your question, not a screenshot of it. Then we can copy and paste the problem lines into the answer.</p>

<p>You are varying up and down the variable <code>motorVoltage</code> in two loops. However you are not then doing an <code>analogWrite</code> with the new value. It should be more like this:</p>

<pre class="lang-c++ prettyprint-override"><code>while (motorVoltage &lt;= 255)
  {
  analogWrite (motorPower, motorVoltage);
  motorVoltage++;
  delay (200);
  }
</code></pre>
