Hello, i want to ask how we make pwm off after generate few cycle??
so the code like this:
for(int i=0;i<=5008;i++)
{
//analogWrite(13,125);
digitalWrite(13,HIGH);
delayMicroseconds(300);
digitalWrite(13,LOW);
delayMicroseconds(300);
}
but what i want is using pwm, because when i using code like that, my motor didnt go precision..
example is pwm stop after make 5008 pulse
The analogWrite (to pin 13, which is not PWM capable) is commented out.
What the OP has is fine for 5008 300uS wide pulses. Just not very effective apparently.
5008 x (.0003 Sec x 2) = 3 seconds of activity.
If an LED/resistor was connected, it would look 1/2 bright for 3 seconds. Need to know the motor is connected - MOSFET to sink current thru a simple motor for example.