Arduino Forum

Community => Gigs and Collaborations => Topic started by: ak95 on Jan 23, 2017, 06:14 pm

Title: I need to to start the PWM in specific time
Post by: ak95 on 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 ;
}
Title: Re: I need to to start the PWM in specific time
Post by: CrossRoads on Jan 23, 2017, 06:37 pm
Need == here:
if ( t = 0.021)

What is t? millis() returns whole numbers, as does  micros().
Title: Re: I need to to start the PWM in specific time
Post by: ak95 on 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