//--------------------------------------------------------------- //--- Blinks an LED in increasing numbers of blinks. // It counts up to 10 and then resets to 1. // // Setup: Wire an LED from Digital Pin 7 thru a 330 ohm resistor to ground //--------------------------------------------------------------- int ledPin = 7; int count = 0; void setup() { // Only do once at startup pinMode(ledPin, OUTPUT); // initialize digital pin as output (for LED.) } void loop() { count = blinkAdder(count); if(count > 10) { count = 0; } for(int i = 0; i < count; i++){ digitalWrite(ledPin, HIGH); delay(100); digitalWrite(ledPin, LOW); delay(100); } delay(800); } int blinkAdder(int num){ num = num + 1; return num; } |