#include #include #include #include using namespace std; int fibonacci(int input) { int myList [input]; myList[0] = 0; myList[1] = 1; for(int index = 2; index <= input; index++) { myList[index] = myList[index-1] + myList[index-2]; } return myList[input]; } // make an arc for a portion p (0.0 to infinity) of a circle of diameter d, positive p for counterclockwise movement, negative p for clockwise movement, both make robot move forward void makeArc (int d, double p) { if (p > 0) { robot.motors((d/2.0-3.18421)/(d/2.0+3.18421),1.0); wait((d*0.536+3.1)*p); robot.motors(0.0,0.0); } else if (p < 0) { p = -p; robot.motors(1.0,(d/2.0-3.18421)/(d/2.0+3.18421)); wait((d*0.536+3.1)*p); robot.motors(0.0,0.0); } else { cout << "You did stuff wrong you dumb person"; } } void makeArc (int d) { makeArc(d,1); } void makeCircle (int d) { makeArc(d); } //positive degrees for cunterclockwise movement //negative degrees for clockwise movement void turnAngle (int degrees) { makeArc(0,degrees/360.0); } void move(double inches) { robot.motors(1.0,1.0); wait(inches/6.0); robot.motors(0.0,0.0); } int main() { connect("/dev/rfcomm0"); cout << "Waiting..." << endl; wait(2); int radius, diameter; cout << "Enter the radius of your first quarter circle" << endl; cin >> radius; diameter = radius * 2; int steps; cout << "Enter the amount of fibonacci steps to draw:" << endl; cin >> steps; for(int i = 1;i <= steps;i++) { makeArc(diameter * fibonacci(i),0.25); } cout << "Waiting..." << endl; wait(5); cout << "Disconnecting" << endl; disconnect(); return 0; }