Sustained Output Patterns

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
HooctAwnFonix
 
Posts: 77
Joined: Tue Sep 13, 2011 11:47 am

Sustained Output Patterns

Post by HooctAwnFonix »

I've been playing around with LCD's and buzzers and I'm running into a problem.

I have methods like this, which does what it says

Code: Select all

void intermittentBuzz(){
     for(int i=0;i<100;i++){
      digitalWrite(3,255);
      delay(3);
      digitalWrite(3,0);;
      delay(3);  
   }
  delay(1000); 
}
or things like this that make the LCD flicker between RED and BLUE:

Code: Select all

void flickerLCD(){
for(int i=0;i<2;i++){
        if(i%2==0){
          setBlue();
          
        }
        else{
          setRed();
        }
        delay(300);
}
But no surprise, they only work as long as there aren't other functions of the same style, ie: the program loops around fast enough so that it works.

Is there a way that I can program a pin to do a certain pattern and to keep doing it until I tell it to do something else?

User avatar
adafruit_support_bill
 
Posts: 88098
Joined: Sat Feb 07, 2009 10:11 am

Re: Sustained Output Patterns

Post by adafruit_support_bill »

Check out the SimpleTimer library over at the Arduino Playground.

HooctAwnFonix
 
Posts: 77
Joined: Tue Sep 13, 2011 11:47 am

Re: Sustained Output Patterns

Post by HooctAwnFonix »

Well that's absolutely perfect - thanks!

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”