Shop OBEX P1 Docs P2 Docs Learn Events
Chompin' at the bit! Truckin' Mike's First post! — Parallax Forums

Chompin' at the bit! Truckin' Mike's First post!

TruckinMikeTruckinMike Posts: 5
edited 2009-12-25 16:42 in BASIC Stamp
' {$STAMP BS2}
' {$PBASIC 2.5}
'what's a microcontroller - pleaseletmykitcomein.bs2
'Explaining TruckinMikes parallax Basic Stamp delivery condition



DEBUG "I hope I'm not disrupting the BASIC STamp forum topic guidelines. I could not find an introduction thread using the search tool."
DEBUG "I have made it to page 86 so far in the What's a microcontroller manual -- without a basic stamp kit. But I'm gung ho and learning"
DEBUG "And yes, I have really been chompin' at the bit while waiting for my basic stamp kit to get to me.burger.gif"
DEBUG "Good news, I just now got a load back to TEXAS, I'm in Seattle. I'll should be home experimenting by next Tuesday."
DEBUG "Looking forward to getting to know everyone..."

truckinmike VAR byte
mybasickit VAR bit
delivered VAR nib

Do
IF (mybasickit = delivered) THEN
HIGH TruckinMike
DO
DEBUG CLS
DEBUG "Ya-Hoo"
PAUSE 1000
DEBUG CLS
PAUSE 1000
DEBUG "Yee-Haw!
PAUSE 1000
LOOP
ELSE
LOW TruckinMike
ENDIF
DEBUG CLS
DEBUG "Maybe Wednesday...cry.gif "
LOOP

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"A truck driver was heading down the highway when he saw a priest at the side of the road. Feeling it was his duty, he stopped to give the priest a ride. A short time later, he saw a lawyer with a briefcase on the side of the road and aimed his truck at him. At the last second, he thought of the priest with him and realized he couldn't run over the lawyer, so he swerved, but he heard a thump anyway. Looking back as he drove on, he didn't see anything. He began to apologize for his behavior to the priest. "I'm sorry, Father. I barely missed that lawyer at the side of the road."

But the priest said, "Don't worry, son. I got him with my door."

Comments

  • iDaveiDave Posts: 252
    edited 2009-12-10 01:01
    Ha! Very creative TruckinMike. You get style points for your first post!
    From one Texan to another I think I speak for all here and say welcome.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "A complex design is the sign of an inferior designer."
  • TruckinMikeTruckinMike Posts: 5
    edited 2009-12-10 02:32
    Thank you. Glad to be here. I've read wonderful things about this bunch.smile.gif But I'm really surprised that no one caught my error. I need another pause after the first DEBUG CLS. Otherwise the yee-haw would just go right into the ya-hoo without time to reflect on the moment. And you know what a catastrophe that would be!

    TMike

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "A truck driver was heading down the highway when he saw a priest at the side of the road. Feeling it was his duty, he stopped to give the priest a ride. A short time later, he saw a lawyer with a briefcase on the side of the road and aimed his truck at him. At the last second, he thought of the priest with him and realized he couldn't run over the lawyer, so he swerved, but he heard a thump anyway. Looking back as he drove on, he didn't see anything. He began to apologize for his behavior to the priest. "I'm sorry, Father. I barely missed that lawyer at the side of the road."

    But the priest said, "Don't worry, son. I got him with my door."
  • Mike2545Mike2545 Posts: 433
    edited 2009-12-10 18:10
    Also you might want a CR at the end of each debug Like so:

    DEBUG "I hope I'm not disrupting the BASIC STamp forum topic guidelines. I could not find an introduction thread using the search tool ."· ,CR
    DEBUG "I have made it to page 86 so far in the What's a microcontroller manual -- without a basic stamp kit. But I'm gung ho and learning" ,CR
    ·
    DEBUG "And yes, I have really been chompin' at the bit while waiting for my basic stamp kit to get to me.burger.gif" ,CR
    DEBUG "Good news, I just now got a load back to TEXAS, I'm in Seattle. I'll should be home experimenting by next Tuesday."· ,CR
    DEBUG "Looking forward to getting to know everyone..."· ,CR



    CR is Carriage Return, with out it your senteses will just run together.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Mike2545

    This message sent to you on 100% recycled electrons.
  • TruckinMikeTruckinMike Posts: 5
    edited 2009-12-10 22:10
    Thanks! Good catch. It just goes to show -- you really do learn something everyday.smile.gif

    TMike

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "A truck driver was heading down the highway when he saw a priest at the side of the road. Feeling it was his duty, he stopped to give the priest a ride. A short time later, he saw a lawyer with a briefcase on the side of the road and aimed his truck at him. At the last second, he thought of the priest with him and realized he couldn't run over the lawyer, so he swerved, but he heard a thump anyway. Looking back as he drove on, he didn't see anything. He began to apologize for his behavior to the priest. "I'm sorry, Father. I barely missed that lawyer at the side of the road."

    But the priest said, "Don't worry, son. I got him with my door."
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-12-10 23:04
    TMike, that's what these forums are here for. Even the moderators learn something new almost daily. That's a good thing.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Parallax Engineering
    Check out the new Savage Circuits TV!
    ·
  • Mike2545Mike2545 Posts: 433
    edited 2009-12-10 23:10
    Yes and I learned how to spell ''sentences '' tongue.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Mike2545

    This message sent to you on 100% recycled electrons.
  • TruckinMikeTruckinMike Posts: 5
    edited 2009-12-25 01:42
    Wa-Hoo!!hop.gif After being stuck in Snowville,UT (in a snow storm), having to chain up to cross Snoqualmie pass, stuck in sublet,ID and 3 weeks on the road with "Whats a Microcontroller" at my side I finally made it home (around noon). I'm now with my BS2!!!

    Let the fun Begin!!!

    Thanks,
    TMike

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "A truck driver was heading down the highway when he saw a priest at the side of the road. Feeling it was his duty, he stopped to give the priest a ride. A short time later, he saw a lawyer with a briefcase on the side of the road and aimed his truck at him. At the last second, he thought of the priest with him and realized he couldn't run over the lawyer, so he swerved, but he heard a thump anyway. Looking back as he drove on, he didn't see anything. He began to apologize for his behavior to the priest. "I'm sorry, Father. I barely missed that lawyer at the side of the road."

    But the priest said, "Don't worry, son. I got him with my door."
  • VANITYVANITY Posts: 6
    edited 2009-12-25 02:29
    Being stuck in a snow storm is no excuse for not having your BS2 - the BS2 is rated down to 20 degrees F!!!
  • TruckinMikeTruckinMike Posts: 5
    edited 2009-12-25 16:42
    EDIT: Vanity, I will be bringing the BS2 with me! Yes, me and my bs2, side by side, through the mountains and plains, together at last! And even though the BS2 is ok at 20F, believe me, she won't be cold... hee hee hee smilewinkgrin.gif



    but alas, the problems begin...

    I'm working on the "reaction timer" in the WHat's a microcontroller guide (p.99). I made the game for two players as instructed. But with one problem.

    Note1: I'm using two leds, instead of the bi-color led per instructions (I don't have one).

    Note2: I'm working on the professional development board. The PDB buttons are held normally high, and low when pressed.

    Game function:

    1. both players must press their respective input button - IN0 and IN1 buttons
    2. then one led lights up (pin15)
    3. a random number generator creates a pause,
    4. then the START led comes on (pin14)
    5 each person releases their button as fast as possible
    6. I send the reaction times for players and the random pause time to the debug terminal

    All of that works great. The problem is if one or both players released early (before the start led comes on) I could not make debug send a statement to the terminal addressing the issue... here is my code - where did I go wrong?

    Look to the "NOTE" just after "LOW 14". With just one player the "timeCounter" would go to 1 when the player released before the start led came on. --- I suppose It does something different with two players -- thats where all the trouble is...




    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
     ' what is a microcontroller -- reactiontimer2player.bs2
    'reaction timer
      timeCounterA VAR Word
      timeCounterB VAR Word
    
      result VAR Word
      result = 5676   'with a random number gen - you must give a number to the random gen to start with. any num <65535
      randomTime VAR Word
    
    
    DO
         RANDOM result
         randomTime = result/19 + 1000
         ' the "result" of the random num gen was sometimes to large, so I divided by 19 and added 1000ms.
         DO
         LOOP UNTIL (IN0 = 0) AND (IN1 = 0)
         HIGH 15
         PAUSE randomTime
         LOW 15
         HIGH 14
         timeCounterA = 0
         timeCounterB = 0
    
         DO
          IF IN0 = 0 THEN
          timeCounterA = timeCounterA + 1
          ENDIF
          IF IN1 = 0 THEN
          timeCounterB = timeCounterB + 1
          ENDIF
         LOOP UNTIL (IN0 = 1) AND (IN1 = 1)
    
         LOW 14
    
        [b] 'NOTE:  It appears that the timeCounter values are not ever 1, as with just one player ---????
         '       the if-then statements make no difference in the game?[/b]
    
              DEBUG CLS
              DEBUG DEC ? randomTime, " milliseconds",CR,CR
              'IF timeCounterA = 1 THEN
              'DEBUG "Player IN0 cheated!  You must hold the button down until the other LED comes on.",CR
              'ENDIF
              'IF  timeCounterA > 1 THEN
              DEBUG DEC timeCounterA," Input 0",CR,CR
              'ENDIF
              'IF timeCounterB = 1 THEN
              'DEBUG  "Player IN1 cheated!  You must hold the button down until the other LED comes on."
              'ENDIF
              'IF  timeCounterB > 1 THEN
              DEBUG DEC timeCounterB," Input 1",CR, CR
              'ENDIF
    
    
    LOOP
    
    



    I don't want to waste anyone's time, if you could point me in the right direction, links, pdf's, etc that would be fine. The search feature is coming up with zero returns with "reaction timer"???


    Thanks,
    TMike

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "A truck driver was heading down the highway when he saw a priest at the side of the road. Feeling it was his duty, he stopped to give the priest a ride. A short time later, he saw a lawyer with a briefcase on the side of the road and aimed his truck at him. At the last second, he thought of the priest with him and realized he couldn't run over the lawyer, so he swerved, but he heard a thump anyway. Looking back as he drove on, he didn't see anything. He began to apologize for his behavior to the priest. "I'm sorry, Father. I barely missed that lawyer at the side of the road."

    But the priest said, "Don't worry, son. I got him with my door."

    Post Edited (TruckinMike) : 12/25/2009 6:22:32 PM GMT
Sign In or Register to comment.