I am trying to update a PWM to slowly increase the speed of a DC motor. The PWM is switching a transistor. I am trying to start slowly and increase the PWM by which increasing the speed of the motor each time through the loop. See the code below:
int motor = 10;
int a = 20;
void setup()
{
pinMode(motor, OUTPUT);
}
void loop()
{
analogWrite(motor,a);
a+1;
}
The PWM is staying at the initial value of 20 and never increasing. Does anyone know why this is not updating each time through the loop.
Thanks so much. This seems to work exactly how I needed it to for what I am trying to accomplish. I think that delays will have to become my friend. I am sure I will be on the forums quite a bit in the coming weeks.