Devices & Components
Arduino Uno Rev3
Resistor 10k ohm
Standard LCD - 16x2 White on Blue
Rotary potentiometer (generic)
Resistor 221 ohm
Pushbutton switch 12mm
Software & Tools
Arduino IDE
Project description
Code
Untitled file
arduino
1#include <LiquidCrystal.h> 2LiquidCrystal lcd(12, 11, 5, 4, 3, 2); 3int timeToLift = 50; 4int timeToLand = 50; 5String countDown = ""; 6String countDown1 = ""; 7 8void setup() { 9 lcd.begin(16, 2); 10 11 lcd.print("Welcome To:"); 12 lcd.setCursor(0, 1); 13 lcd.print("Rocket Tracker"); 14 lcd.setCursor(0, 0); 15 16 pinMode(7, INPUT); 17 pinMode(8, INPUT); 18 19 delay(1000); 20} 21 22void loop() { 23 if(digitalRead(7) == HIGH) { 24 while(timeToLift > -1) { 25 lcd.clear(); 26 lcd.setCursor(0, 0); 27 countDown = "T- " + String(timeToLift); 28 lcd.print(countDown); 29 30 timeToLift += -1; 31 delay(999); 32 } 33 34 lcd.clear(); 35 lcd.print("LIFTOFF!!"); 36 37 delay(2000); 38 lcd.clear(); 39 40 } else {timeToLift = 50;} 41 42 if(digitalRead(8) == HIGH) { 43 while(timeToLand > random(-44, -24)) { 44 lcd.clear(); 45 lcd.setCursor(0, 0); 46 countDown1 = "T- " + String(timeToLand); 47 lcd.print(countDown1); 48 49 timeToLand += -1; 50 delay(999); 51 52 } 53 54 lcd.clear(); 55 lcd.print("LANDING!!"); 56 delay(2000); 57 lcd.clear(); 58 lcd.print("Arduino 11"); 59 lcd.setCursor(0, 1); 60 lcd.print("Has LANDED!!"); 61 delay(2000); 62 lcd.setCursor(0, 0); 63 64 lcd.clear(); 65 lcd.print("Sucsessfully:"); 66 lcd.setCursor(0, 1); 67 lcd.print("LATE!!"); 68 delay(2000); 69 lcd.setCursor(0, 0); 70 71 } else { 72 timeToLand = 50; 73 74 if(digitalRead(7) == LOW && digitalRead(8) == LOW) { 75 76 lcd.clear(); 77 lcd.print("Rocket:"); 78 lcd.setCursor(0, 1); 79 lcd.print("Arduino 11"); 80 lcd.setCursor(0, 0); 81 82 } 83 } 84 85 delay(100); 86 87// lcd.clear(); 88 89}
Downloadable files
tracker_scetch_Eoimk9UEJn.png
tracker_scetch_Eoimk9UEJn.png

tracker_scetch_Eoimk9UEJn.png
tracker_scetch_Eoimk9UEJn.png

Comments
Only logged in users can leave comments