Go Down

### Topic: I need to to start the PWM in specific time  (Read 637 times)previous topic - next topic

#### ak95

##### Jan 23, 2017, 06:14 pm

I need to start the PWM from 4ms to 10ms and I did it with IF statement but nothing happend

so could any one help me

and one last thing the code that I wrote is

for (t;t<0.022; t=t+0.001)
{
if ( (t>0.004) &&(t<0.011) )
{
aPin1 = (HIGH);
analogWrite (aPin1 ,123);
}
else {
aPin1 = (LOW);
}
if ( (t>0.014) && (t<0.021) )
{
bPin2 = (HIGH);
analogWrite (bPin2 ,123);
}
else {
bPin2 =(LOW);
}
if ( t = 0.021)
{
t = 0 ;
}

#1
##### Jan 23, 2017, 06:37 pm
Need == here:
if ( t = 0.021)

What is t? millis() returns whole numbers, as does  micros().
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

#### ak95

#2
##### Jan 23, 2017, 07:18 pm
Need == here:
if ( t = 0.021)

What is t? millis() returns whole numbers, as does  micros().
Need == here:
if ( t = 0.021)

What is t? millis() returns whole numbers, as does  micros().
yes I want t to work in mills

Go Up