booyaa dot org
  • Adverts

  • 123-reg sucks!

    123-reg screwed up the renewal of my domain (booyaa.org). To read all about it click here

  • Link Exchange

    Allotment Vegetable Growing Allotment diaries, photographs, advice about growing vegetables, fruits and herbs with a forum for chatting on the plot.
  • Meta

  • « Long time no blog! | Home | Arduino: 4 button piezo synth (failed) »

    Arduino: i can haz knight riders!

    By booyaa | January 29, 2008

    You need to go to my blog post to see the video above. Does appear to render in RSS…

    Please excuse the poorly formatted code, I will be using a real pretty pretty code printer real soon!

    
    // making a series of leds light up individually ala knight rider
    
    int sleep = 100;
    int ledPin = 1;
    int maxPins = 6;
    int startPin = 1;
    
    void setup() {
      for( ledPin=1; ledPin<maxPins; ledPin++) {
        pinMode(ledPin, OUTPUT);
      }
    }  
    
    void loop() {
      for( ledPin=1; ledPin<maxPins; ledPin++) {
        digitalWrite(ledPin, HIGH);
        delay(sleep);
        digitalWrite(ledPin, LOW);
        //delay(sleep);
      }
      for( ledPin=4; ledPin>startPin; ledPin--) {
        digitalWrite(ledPin, HIGH);
        delay(sleep);
        digitalWrite(ledPin, LOW);
        //delay(sleep);
      }
    }
    
    

    Topics: Uncategorized |

    Comments

    Subscribe without commenting