Created
January 13, 2012 01:58
-
-
Save patrickdevivo/1604221 to your computer and use it in GitHub Desktop.
Blink LED on Arduino UNO with fibonacci delay
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int ledPin = 13; | |
int i = 0; | |
int fib(int initial) { | |
if (initial <=1) { | |
return initial; | |
} | |
else { | |
return fib(initial-1)+fib(initial-2); | |
} | |
} | |
void setup() { | |
Serial.begin(9600); | |
pinMode(ledPin, OUTPUT); | |
} | |
void loop() { | |
digitalWrite(ledPin, HIGH); | |
delay(1000); | |
digitalWrite(ledPin, LOW); | |
delay(fib(i)*1000); | |
i++; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment