/*
This program calculate Fibonachi number serie:
1,1,2,3,5,8,13,21,34...
each number is the sum of the previous two numbers: 8=5+3, 5=3+2...
Gabby Shimoni, December 2018
*/
long firstNum = 1;
long secondNum = 1;
long sum;
void setup() {
Serial.begin(9600);
sum = firstNum + secondNum;
Serial.println(firstNum);
Serial.println(secondNum);
Serial.println(sum);
}
void loop() {
firstNum = secondNum;
secondNum = sum;
sum = firstNum + secondNum;
Serial.println(sum);
delay(200);
}
Comments