#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int timeToLift = 50;
int timeToLand = 50;
String countDown = "";
String countDown1 = "";
void setup() {
lcd.begin(16, 2);
lcd.print("Welcome To:");
lcd.setCursor(0, 1);
lcd.print("Rocket Tracker");
lcd.setCursor(0, 0);
pinMode(7, INPUT);
pinMode(8, INPUT);
delay(10000);
}
void loop() {
if(digitalRead(7) == HIGH) {
while(timeToLift > -1) {
lcd.clear();
lcd.setCursor(0, 0);
countDown = "T- " + String(timeToLift);
lcd.print(countDown);
timeToLift += -1;
delay(999);
}
lcd.clear();
lcd.print("LIFTOFF!!");
delay(2000);
lcd.clear();
} else {timeToLift = 50;}
if(digitalRead(8) == HIGH) {
while(timeToLand > random(-44, -24)) {
lcd.clear();
lcd.setCursor(0, 0);
countDown1 = "T- " + String(timeToLand);
lcd.print(countDown1);
timeToLand += -1;
delay(999);
}
lcd.clear();
lcd.print("LANDING!!");
delay(2000);
lcd.clear();
lcd.print("Arduino 11");
lcd.setCursor(0, 1);
lcd.print("Has LANDED!!");
delay(2000);
lcd.setCursor(0, 0);
lcd.clear();
lcd.print("Sucsessfully:");
lcd.setCursor(0, 1);
lcd.print("LATE!!");
delay(2000);
lcd.setCursor(0, 0);
} else {
timeToLand = 50;
if(digitalRead(7) == LOW && digitalRead(8) == LOW) {
lcd.clear();
lcd.print("Rocket:");
lcd.setCursor(0, 1);
lcd.print("Arduino 11");
lcd.setCursor(0, 0);
}
}
delay(100);
// lcd.clear();
}
Published September 11, 2018
Comments