#include Servo myservo; //This section is all the basic stuff you need before you write your program for your servo. int i = 0; // initialize i , the logic for the servo int ledpins [] = {2,5}; // The pins you're gonna use int end; int pos = 135; void setup() // write the program under ''void setup'' to make the servo read the program once and end. For loop : Void Loop { myservo.attach(9); // Calling pin 9, wich gives orders to he Servo, The Servo also needs voltage and ground pinMode(2,1); // Calling pin 2, position 1 pinMode(5,1); // Calling pin 5, position 1 while (i<1) { //inital position myservo.write(135); // initial position 45 degres delay(200); // delay of 200 milliseconds i++; // tells the program to add the reading one after another } while (i<20) { // for the first 19 readings of the program until the 20th reading. (really fast) digitalWrite(5, 1); // indicating the initiation of the program pin 5, position 1 (ON), Red light blinking only delay(50); // delay is 50 milliseconds because the led is on/off pretty fast digitalWrite(5, 0); // Pin 5 is Off , LED is off delay(50); //delay 50 milliseconds i++; // tells the program to add the reading one after another } while(i<21){ // Now at the 21st reading, the Servo stays up, the coffee stream stays off and the coffee machine heats up. myservo.write(135); //coffee OFF rotation degres delay(65000); //65 sec Coffe machine stays off for 65 seconds myservo.write(45); //coffee ON rotation degres ---- The coffee Stream activates delay(11000); // for 11 sec The coffee Stream activates i++; // tells the program to add the reading one after another } while(i<24){ // at the 24 reading The coffe stream goes from on to off myservo.write(135); //coffee OFF rotation degres delay(40000); //40 sec myservo.write(45); //coffee ON rotation degres delay(11000); //11 sec i++; } while(i<25){ myservo.write(135); // THE END coffee off rotation degres delay(1000); i++; } while(i<300){ // This part makes the green LED blink for 300 readings slowly to Warn that the Coffee is ready digitalWrite(2, 1); // turn the LED on delay(500); digitalWrite(2, 0); // turn the LED off delay(500); i++; } } void loop() { }