You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi everybody
I'm new in C++ and in Arduino and I have a question (Sorry if this question may seem too obvius, but for three weeks I tried by myself without any result and aparently I need to ask help to someone). I'm trying for my project to make an "irregular" blink with this library. With the "millis()" metod I did like this:
unsignedlong t;
voidsetup() {
// put your setup code here, to run once:pinMode(pin,OUTPUT);
t=millis();
}
voidloop() {
// put your main code here, to run repeatedly:if(millis()-t>=1000){
digitalWrite(pin,!digitalRead(pin));
t=millis();
}
if(millis()-t>=2000){
digitalWrite(pin,!digitalRead(pin));
t=millis();
}
}
Practically I want that the delay where the pin is LOW be different by the time where the pin is HIGH. I had already see the #83 discussion but I can't adapt those codes to my application. How could I make this with a program that can dynamically change in the loop()?
Thanks to everybody who will answer me.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi everybody
I'm new in C++ and in Arduino and I have a question (Sorry if this question may seem too obvius, but for three weeks I tried by myself without any result and aparently I need to ask help to someone). I'm trying for my project to make an "irregular" blink with this library. With the "millis()" metod I did like this:
Practically I want that the delay where the pin is LOW be different by the time where the pin is HIGH. I had already see the #83 discussion but I can't adapt those codes to my application. How could I make this with a program that can dynamically change in the loop()?
Thanks to everybody who will answer me.
Beta Was this translation helpful? Give feedback.
All reactions