SACC

/ / navigation


Knightrider
Arrays
Shooting Star
Shift Register
Light Detector

/ / Knightrider



The following exercises are about sequential programming and good programming techniques for the I/O board.

LedOnPin13.jpg

  1. Wire your board so that pins 2-9 are outputs with LEDs attached to them.

  2. Each LED needs a 220 resistor.

  3. Place a pull-down resistor switch on pin 10.

  1. Write code to make the LEDs blink in a sequence, one by one using only digitalWrite(pinNum,HIGH/LOW) and delay(time).
    The lights should turn on and off after the button is pressed and stop when the button is pressed again.


  2. Write code to make the LEDs blink in a sequence, one by one using two for loops—One loop to turn on the lights and another to turn them off.
    This is the syntax for a for loop
    for(init;condition;next){
    
    }
    init is where you set a variable, like int led=2;
    condition is how long the loop will continue, like led<=9;
    next is where you increment or decrement the variable, like led++;




http://aterribleidea.com/2009/02/25/building-an-arduino-based-laser-tag-game/