I have one of those days that something is so simple,
You can’t get your head around it.
Simple Toggle
So this will toggle unlimited, I think.
I would like use this inside a function to set the number of pulses during a period of time in mseconds or seconds.
It repeats 5 and should stop and jump out of the loop correct?
The real question is
How do I create a burst of pulses during an given amount of time and set the number of pulses over this Time. I have something like an interval, the Same as this example.
However this sets the pulses during the ON time but I don’t have control over the pulses and their respective time they are high or low.
Can someone help me out?
You can’t get your head around it.
Simple Toggle
Code:
Void setup()
{
pinMode(13,OUTPUT);//led during On Time
pinMode(0,OUTPUT);
pinMode(1,OUTPUT);
}
Void loop()
{
// probably I’ll have to set the condition of the pin =0; because the compiler doesn’t know
If(digitalRead(0)==HIGH)
{
digitalWrite (0,LOW);
}
else
{
digitalWrite(0,HIGH);
}
}
}
So this will toggle unlimited, I think.
I would like use this inside a function to set the number of pulses during a period of time in mseconds or seconds.
Code:
Void setup()
{
pinMode(13,OUTPUT);//led during On Time
pinMode(0,OUTPUT);
pinMode(1,OUTPUT);
}
Void loop()
{
for(int i =0; i<5;i++)
{
If(digitalRead(0)==HIGH)
{
digitalWriteFast(0,LOW);
}
else
{
digitalWriteFast(0,HIGH);
}
}
}
The real question is
How do I create a burst of pulses during an given amount of time and set the number of pulses over this Time. I have something like an interval, the Same as this example.
HTML:
https://www.baldengineer.com/millis-ind-on-off-times.html
Can someone help me out?