element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum Arduino LCD Timer
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 14 replies
  • Subscribers 394 subscribers
  • Views 1200 views
  • Users 0 members are here
Related

Arduino LCD Timer

Former Member
Former Member over 11 years ago

Hi All,

 

I am making a model rocket launch controller, it features a safety, Arm switch, a launch button, and a 16x2 LCD display. So to launch the rocket you Arm the Rocket by flipping the arming switch. Then you turn the saftey key, which is an electronic safety. A HIGH signal is passed through the key switch, which allows the rocket to launch. here is my current code.

 

#include <LiquidCrystal.h>
LiquidCrystal lcd(2,3,4,5,6,7);


//Define Booleans
boolean Armed = true;
boolean Safe = true;
boolean DeArmedTestPassed = false;
boolean HasLaunched = false;
boolean Launch = false;
//Define Pins
int ArmPin = 8;
int SafePin = 9;
int LaunchPin = 10;
int Piezo = 11;
int Igniter = 12;
int SwitchLed = 13;
int PotPin = 0;


char * erase = "                ";


int PotVal = 0;


void setup()
{
pinMode(ArmPin, INPUT);
pinMode(SafePin, INPUT);
pinMode(PotPin, INPUT);
pinMode(LaunchPin,INPUT);
Serial.begin(9600);
lcd.begin(16,2);




    for(int i = 0; i <= 2; i++)
      {
lcd.setCursor(0,0);
lcd.println("    Welcome To    ");
lcd.setCursor(0,1);
lcd.println(" Rocket Launch 1 ");
delay(1000);
lcd.setCursor(0,1);
lcd.println(erase);
lcd.setCursor(0,0);
lcd.println(erase);
delay(1000);
      }


lcd.clear();



   for(int j = 1; j  < 3; j++) // CHANGE ME
     {
    lcd.setCursor(0,0);
    lcd.print("   Loading      "); //10
    delay(500);
    lcd.setCursor(10,0);
    lcd.print(".");
    delay(500);
    lcd.setCursor(11,0);
    lcd.print(".");
    delay(500);
    lcd.setCursor(12,0);
    lcd.print(".");
    delay(500);
     }
lcd.clear();

if(digitalRead(ArmPin) == HIGH)
  DeArmedTestPassed = false;

else if(digitalRead(ArmPin) == LOW)
DeArmedTestPassed = true;

digitalWrite(13,LOW);
}


void loop()
{

  if(DeArmedTestPassed)
      {
    PotVal = (analogRead(PotPin), 0, 1023, 0, 120); //Figure me out
    lcd.setCursor(0,0);
    delay(100);
    if(digitalRead(ArmPin) == HIGH && !HasLaunched)
        Armed = true;
    else
        Armed = false;
    if(digitalRead(SafePin) == HIGH)
        Safe = true;
    else
        Safe = false;
        if(digitalRead(LaunchPin) == HIGH)
        Launch = true;
   
    if(Armed)
      {
        lcd.setCursor(0,0);
        lcd.print("Status    Armed ");
        delay(250);
        HasLaunched = false;
      }
    else
      {
        lcd.setCursor(0,0);
        lcd.print("Status  Un-Armed");
        delay(250);
      }
    if(Safe)
      {
         lcd.setCursor(10,1);
         lcd.print(" SAFE ");
      }
    else
      {
         lcd.setCursor(10,1);
         lcd.print("      ");
      }


    if(Armed && !Safe && !HasLaunched)
    {
     lcd.setCursor(9,1);
     lcd.print("LAUNCH");
     delay(150);
     lcd.setCursor(9,1);
     lcd.print("      ");
     delay(150);
    }
   
    lcd.setCursor(0,1);
    lcd.print("T 00:00");
     }


    else if(!DeArmedTestPassed)
      {
         lcd.setCursor(0,0);
         lcd.print("Please de-arm   ");
         lcd.setCursor(0,1);
         lcd.print("device & reset");
      }
      if(Armed && !Safe && !HasLaunched &&  Launch)
      {
       lcd.setCursor(8,1);
       lcd.print("LAUNCH!");
       digitalWrite(13, HIGH);
       delay(1500);
       digitalWrite(13, LOW);
       lcd.setCursor(8,1);
       lcd.print("        ");
       Launch = false;
       Armed = false;
       HasLaunched = true;
      }
}

So here is my problem. I will have a 10k pot. And as I turn it I want the time displayed(mock up at line 140)  to increase to 2:00 when the pot is at max, and 00:05 at 0 pot. And once the system is unsafe and armed, you can initiate the launch. Once the launch is initiated it will count down and update the display to the new time every second. I have absolutely no idea how to set up the timer and display the decreasing time. I know I will have to use some form of a for loop. Bout it image

Thanks Guys,

 

Austin

  • Sign in to reply
  • Cancel

Top Replies

  • kidiccurus
    kidiccurus over 11 years ago +1
    Wow, another arduino detonator, there seem to be a lot of them at the moment. Not the answer to your question but lines 29 to 32, shouldn't at lest one pin be set as output.
  • kidiccurus
    kidiccurus over 11 years ago in reply to nschreiber0813 +1
    You rember I said there were a lot of detonators at the moment. This is what I was taking about (Noah). I also have a friend working on a simple microcontroller free version.
  • Former Member
    Former Member over 11 years ago +1
    Hey Noah, I will record a little video later showing you the progress I have made. If you want to talk about it email me at austin2118ace@gmail.com this is not the best place to discuss it. -Austin
Parents
  • kidiccurus
    0 kidiccurus over 11 years ago

    Wow, another arduino detonator, there seem to be a lot of them at the moment. Not the answer to your question but lines 29 to 32, shouldn't at lest one pin be set as output.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 11 years ago in reply to kidiccurus

    Yep, I want to get back into model rocketry, I have an arduino and LCD sitting around and thought what I could do with them.

     

    You are correct. I have the igniter pin set but am not at the point I need to work with it. So I didn't bother setting it up.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • Former Member
    0 Former Member over 11 years ago in reply to kidiccurus

    Yep, I want to get back into model rocketry, I have an arduino and LCD sitting around and thought what I could do with them.

     

    You are correct. I have the igniter pin set but am not at the point I need to work with it. So I didn't bother setting it up.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube