Shop OBEX P1 Docs P2 Docs Learn Events
how to code Day Month and Year on two — Parallax Forums

how to code Day Month and Year on two

DoggDogg Posts: 4
edited 2009-11-21 22:11 in BASIC Stamp
redface.gif
· Need Help:

···················· I am looking for information on how to code Day Month· and Year on two

··················· Pushbuttion Control. Any help or code would be appreciated. I using a BS2E

··················· Stamp.

··················· Thanks Dogg.

Post Edited By Moderator (Bean (Hitt Consulting)) : 11/21/2009 2:49:41 PM GMT

Comments

  • SRLMSRLM Posts: 5,045
    edited 2009-11-21 18:38
    Can you show us what you have so far?
  • DoggDogg Posts: 4
    edited 2009-11-21 19:31

    ·SRLM:

    ···roll.gif·
    ········· ······ Here is the code That I am trying to design two Push-Buttons to Control.

    ········· Date:

    ················· Enter Month:

    ······································· Serout 16,B96,[noparse][[/noparse]CR,"Enter Month (1.....12)..]
    ········································Serin 16,B96,[noparse][[/noparse]DEC2 month]
    ······································ ·IF(month < 1) Or (Month > 12)Then Enter_Month

    ················ ·Enter_Day:
    ····································· · Serout 16,B96,[noparse][[/noparse]CR,"Enter Day· (1....31).."]
    ····································· · Serin· 16,B96,[noparse][[/noparse]DEC2 day]
    ····································· · IF(day· < 1) Or (day > 31)Then Enter_Day

    ············· · Enter_Year:····
    ···································· ··Serout 16,B96,[noparse][[/noparse]CR,Enter Year (00).."]
    ····································· ·Serin 16,B96,[noparse][[/noparse]DEC2 Year]
    ····································· ·F(Year < 02)Then Enter Year

    ················Any assistance would be very much appreciated. I am only trying to Input the above

    ·············· Information on two Pushbuttons switches to set the month day and year...

    ············· Thank you for your time and input.· PS: Baud is 9600
    ·············
    ··············Dogg
    ·······································
  • Mike GreenMike Green Posts: 23,101
    edited 2009-11-21 19:39
    How do you want the pushbuttons to work? There are many many possible ways to do this. What do you want?
  • DoggDogg Posts: 4
    edited 2009-11-21 20:25

    ·· Mike:

    ··········· Thanks for the quick reply.

    ··········· What I am trying to accomplish is take two N/O Pushbuttions to set the month day and year.

    ··········· If this is possible.

    ············The day would be set and then incremented to the month with the same pushbutton. And

    ·········· finally the year would be set with the second Pushbutton. Any help would be appreciated.


    ·········· Again thanks for the quick reply.

    ········· Dogg..
  • Mike GreenMike Green Posts: 23,101
    edited 2009-11-21 21:03
    Of course it's possible. How are you going to do it? Do you know how to handle pushbuttons with a Stamp? If not, you should go though the "What's a Microcontroller?" tutorial from Parallax.

    If you know how to handle pushbuttons, then how would you do what you want to do? What specific button presses would do what? It sounds from your description that you have a "mode" where the first mode is "set month", the second mode is "set day", and the third mode is "set year". Modes are also known as states in programming. How would you progress from the initial state to each of the three other states, then back? What might a pseudo-program look like? How would you keep track of what mode you're in? There are several different ways including the use of a variable or the use of a particular loop / label in the program.
  • DoggDogg Posts: 4
    edited 2009-11-21 21:58
    ·

    ·· Mike:

    ·········· Thanks for your Help.

    ·········· Dogg
  • Mike GreenMike Green Posts: 23,101
    edited 2009-11-21 22:11
    Be sure to look at the BUTTON statement. There's a whole chapter in the BASIC Manual on that. The nice part is that it includes an auto-repeat function which you'd want to use for your situation. The user would be able to hold down the pushbutton and have the mode advance or have the number (month/day/year) advance without having to push once for each advance.
Sign In or Register to comment.