Shop OBEX P1 Docs P2 Docs Learn Events
My Hover Craft — Parallax Forums

My Hover Craft

Microman171Microman171 Posts: 111
edited 2005-12-17 09:49 in General Discussion
I have the idea to make a hovercraft run via the w, a, s, d keys how can I do this w/o debugin or even with it but so i can continuesly read the key. If i leave it how it is then i push the w key once and the BS2 stamp just keeps transmitting via the hacked hovercraft controller. Can somebody please post their code on how to do this because my 1st attempt made the moters kinda pulse then the 2nd attempt made the motor go until the hovercraft was turned off and reset pushed. I would like to run of the key board because if I make some kind of controller that defeats the purpose of the project.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
1 + 1 = Window

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
0............................................0
0............................................0
0.(Microman171@hotmail.com)..0
0............................................0
0............................................0
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
«1

Comments

  • Microman171Microman171 Posts: 111
    edited 2005-10-23 19:07
    What Im trying to say is i need to continuessly read the keyboard eg.
    W
    a s d

    W being the one pressed Debugin should write the value of W to a Varialble caller user but once i push that either A it stops after a few milliseconds regardless of me finishing pushing or not then it will loop creating the pulse effect and that is no good. Or B i push the button once and it goes forever. Either A I need a new command for my BS2 to read from the keyboard or B Im doing something wrong about the way im useing it. I've attached code if that helps:
    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    
    
    LeftF       PIN      12
    LeftR       PIN      13
    RightF      PIN      14
    RightR      PIN      15
    user        VAR      Byte(1)
    
    'System Test Initiating...
    
    'HIGH LeftF
    'PAUSE 2000
    'LOW LeftF
    
    'System Check Finished
    
    DO
    
      DEBUGIN STR user\1\1
    
      ' Forward = W
      IF (user = "w") THEN
    
        HIGH LeftF
        HIGH RightF
        PAUSE 250
        LOW LeftF
        LOW RightF
    
      ENDIF
    
      ' Brake = S
      IF (user = "s") THEN
    
        HIGH LeftR
        HIGH RightR
        PAUSE 250
        LOW LeftR
        LOW RightR
    
      ENDIF
    
      ' Left = A
      IF (user = "a") THEN
    
        HIGH LeftF
        HIGH RightR
        PAUSE 500
        LOW LeftF
        LOW RightR
    
      ENDIF
    
      ' Right = D
      IF (user = "d") THEN
    
        HIGH LeftR
        HIGH RightF
        PAUSE 500
        LOW LeftR
        LOW RightF
    
      ENDIF
    
    LOOP
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    1 + 1 = Window

    /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    0............................................0
    0............................................0
    0.(Microman171@hotmail.com)..0
    0............................................0
    0............................................0
    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  • kingnebkingneb Posts: 65
    edited 2005-10-24 02:37
    Are you using a keyboard directly attached to the BASIC STAMP? Are you connected through the parallel port, USB, or RS-232 port, or something else?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    All my exes live in Texas


    Oh yeah, all my exes are six feet under the ground!!!

    One was a lineman who violated the one hand rule.

    The·second put his tongue on 10 car batteries wired in series.

    The third was involved in a tesla coil experiment gone bad.
  • Microman171Microman171 Posts: 111
    edited 2005-10-24 06:18
    None of the above sorry. It's useing the debug window with the stamp attacheched seraily to the computer and im useing a usb keyboard that is what im typing with right now

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    1 + 1 = Window

    /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    0............................................0
    0............................................0
    0.(Microman171@hotmail.com)..0
    0............................................0
    0............................................0
    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  • Microman171Microman171 Posts: 111
    edited 2005-10-24 17:50
    FYI the code I posted earlyer was the actual code for step one eyes.gif And just the normal serial port that you would program the stamp with BTW not the USB the other one on the back of the computer

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    1 + 1 = Window

    /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    0............................................0
    0............................................0
    0.(Microman171@hotmail.com)..0
    0............................................0
    0............................................0
    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  • kingnebkingneb Posts: 65
    edited 2005-10-24 19:33
    I would use a program that listens for data on a serial or parallel port. If you want the basic stamp to listen for serial data directly off the port you need to use the serin or debugin statement. That can get messy so I just use the parallel port. Write a program that sets a certain bit in the parallel port when a key is pressed and clears it when you release the key (Use C or Basic or something). Program the basic stamp to react when that bit is high. Use LED's to test to see if the stamp is responding appropiately to your keyboard input before you go directly to hovercraft control.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    All my exes live in Texas


    Oh yeah, all my exes are six feet under the ground!!!

    One was a lineman who violated the one hand rule.

    The·second put his tongue on 10 car batteries wired in series.

    The third was involved in a tesla coil experiment gone bad.

    Post Edited (kingneb) : 10/24/2005 9:24:33 PM GMT
  • Tom WalkerTom Walker Posts: 509
    edited 2005-10-24 21:02
    kingneb,
    Microman171 is using the DEBUGIN (which is a specialized form of SERIN) command to accept input from the computer.

    Microman171,
    What you are looking for would probably be a good candidate for a "state machine" style of code. This has been covered before on this forum. With your current program, the Stamp "interprets" the key, and "moves a little" then looks for another key. If you want the craft to keep going, don't turn off the motors (the LOW commands in your code) until they need to be turned off...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Truly Understand the Fundamentals and the Path will be so much easier...
  • Microman171Microman171 Posts: 111
    edited 2005-10-25 04:34
    sadly i tried that cry.gifcry.gif What happens is it read the key moves and continues to read when i stop pushing can somebody please post code for this??

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    1 + 1 = Window

    /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    0............................................0
    0............................................0
    0.(Microman171@hotmail.com)..0
    0............................................0
    0............................................0
    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  • DiablodeMorteDiablodeMorte Posts: 238
    edited 2005-10-25 16:28
    You need to create a visual basic program that sends data to the stamp. I'm at school right now but when i get home i'll try to post something
  • Microman171Microman171 Posts: 111
    edited 2005-10-25 17:38
    thanks man

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    1 + 1 = Window

    /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    0............................................0
    0............................................0
    0.(Microman171@hotmail.com)..0
    0............................................0
    0............................................0
    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  • DiablodeMorteDiablodeMorte Posts: 238
    edited 2005-10-25 19:42
    Do you have visual basic or do you want me to make this program actually look good?
  • DiablodeMorteDiablodeMorte Posts: 238
    edited 2005-10-26 00:57
    Alight. Much to lazy to find code. Here's a link for an example: http://www.geocities.com/SiliconValley/Orchard/6633/vbonoff.html
  • Microman171Microman171 Posts: 111
    edited 2005-10-26 17:37
    Can you please write the code because I dont have VB5

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    1 + 1 = Window

    /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    0............................................0
    0............................................0
    0.(Microman171@hotmail.com)..0
    0............................................0
    0............................................0
    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  • DiablodeMorteDiablodeMorte Posts: 238
    edited 2005-10-26 19:38
    ok. I'll work on it. Give me a day
  • John Raplee, JrJohn Raplee, Jr Posts: 32
    edited 2005-10-26 20:29
    Want to know somthing that would be really cool? Try making one life size [noparse]:)[/noparse] This way I can sit in it! LOL. I actually wonder if it's possable... Hmm..

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ENIAC: P4 2.8ghz E, 1024MB PC3200 Dual Channel 800MHZ, P4C800E-Deluxe, ATI X800XL, 120GB Sata WD HDD, Audigy 2 ZS Sound, AMG 1080 Antec case, Bose TriPort Headphones.· Running on Windows XP Pro SP 2.

    Monitor: Samsung SyncMaster 930B
  • DiablodeMorteDiablodeMorte Posts: 238
    edited 2005-10-27 00:53
    Lol. Well. Firstly. You would need... Alot of mateials. hmm. Lots of rubber. o.O. you could actually do this. You could use two of those industrial fans that i have in my garage. OMG.... Just where to get the rubber
  • John Raplee, JrJohn Raplee, Jr Posts: 32
    edited 2005-10-27 01:14
    Hmm, lots of old tires melt em down! LOL

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ENIAC: P4 2.8ghz E, 1024MB PC3200 Dual Channel 800MHZ, P4C800E-Deluxe, ATI X800XL, 120GB Sata WD HDD, Audigy 2 ZS Sound, AMG 1080 Antec case, Bose TriPort Headphones.· Running on Windows XP Pro SP 2.

    Monitor: Samsung SyncMaster 930B
  • Tom WalkerTom Walker Posts: 509
    edited 2005-10-27 14:29
    IIRC, they did it on Mythbusters...

    "I reject your reality and substitute my own"

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Truly Understand the Fundamentals and the Path will be so much easier...
  • Microman171Microman171 Posts: 111
    edited 2005-10-29 01:17
    DiablodeMorte have you got the code yet??

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    1 + 1 = Window

    /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    0............................................0
    0............................................0
    0.(Microman171@hotmail.com)..0
    0............................................0
    0............................................0
    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  • Microman171Microman171 Posts: 111
    edited 2005-10-30 05:54
    Is anyone replying to this tread still??

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    1 + 1 = Window

    /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    0............................................0
    0............................................0
    0.(Microman171@hotmail.com)..0
    0............................................0
    0............................................0
    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  • kingnebkingneb Posts: 65
    edited 2005-10-30 06:54
    Hello,

    Have you heard of visual basic.NET? Visual Basic 5 and 6 are obsolete but still used. Worse yet, they are not availible anymore or fully supported. VB.NET has a serial port class build directly into it. If you are not familiar with object oriented programming, learning it is not hard. All you need is those nutshell style tutorials you can find with google searches, not those big fat books you get at borders. nono.gif Too much jargon and too expensive, no bang for buck, LOL. The Beta 2 Visual Basic 2005 is available for free here:

    lab.msdn.microsoft.com/express/vbasic/default.aspx

    I wish you the best of luck smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    All my exes live in Texas


    Oh yeah, all my exes are six feet under the ground!!!

    One was a lineman who violated the one hand rule.

    The·second put his tongue on 10 car batteries wired in series.

    The third was involved in a tesla coil experiment gone bad.
  • Microman171Microman171 Posts: 111
    edited 2005-10-31 04:00
    can you please submit the .exe for what I need??

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    1 + 1 = Window

    /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    0............................................0
    0............................................0
    0.(Microman171@hotmail.com)..0
    0............................................0
    0............................................0
    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  • kingnebkingneb Posts: 65
    edited 2005-10-31 06:59
    The file is too big to upload here. I gave you the link to where you can download in my previous reply. Do you have the internet at your house? If not, you will need it for visual studio 2005 to install, even if I could upload the exe.

    Thank You

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    All my exes live in Texas


    Oh yeah, all my exes are six feet under the ground!!!

    One was a lineman who violated the one hand rule.

    The·second put his tongue on 10 car batteries wired in series.

    The third was involved in a tesla coil experiment gone bad.

    Post Edited (kingneb) : 10/31/2005 7:06:12 AM GMT
    blog.bmp 297.9K
  • kingnebkingneb Posts: 65
    edited 2005-10-31 07:10
    The best way to go is to write your own code with Visual Basic.NET It is well documented and very easy to learn. It should handle serial communications just fine.

    For the basic stamp please use LEDs as logic indicators to see if the stamp is responding correctly to your keyboard transmission. For example, you hit the W key. The response is sketchy, sometimes it lights and other times it does not light or light immediately. That problem is a timing issue. That maybe what you are having.

    See if this works (this assumes you have LEDs connected to pins 0 through 3):

    
    user var byte(1)
    
    start:
    
    debugin STR user\1\1
    
    if (user = "w") then
         high 0
         low 1
         low 2
         low 3
         goto start
    endif
    
    if (user = "s") then
         low 0
         low 1
         low 2
         high 3
         goto start
    endif
    
    if (user = "a") then
         low 0
         high 1
         low 2
         low 3
         goto start
    endif
    
    if (user = "d") then
         low 0
         low 1
         high 2
         low 3
         goto start
    endif
    
    goto start
    
    
    



    Post any problems with logic indication.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    All my exes live in Texas


    Oh yeah, all my exes are six feet under the ground!!!

    One was a lineman who violated the one hand rule.

    The·second put his tongue on 10 car batteries wired in series.

    The third was involved in a tesla coil experiment gone bad.

    Post Edited (kingneb) : 10/31/2005 7:42:45 AM GMT
  • Microman171Microman171 Posts: 111
    edited 2005-10-31 17:54
    kingneb said...
    The file is too big to upload here. I gave you the link to where you can download in my previous reply. Do you have the internet at your house? If not, you will need it for visual studio 2005 to install, even if I could upload the exe.

    Thank You
    No No No what I need is the code for the keyboard reader and the BSII code

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    1 + 1 = Window

    /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    0............................................0
    0............................................0
    0.(Microman171@hotmail.com)..0
    0............................................0
    0............................................0
    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  • kingnebkingneb Posts: 65
    edited 2005-11-01 02:10
    Try the BS2 code I posted previously and setup I recommended. Try playing with that a bit. If I give you VB code you will have the same problem because the "exact same" serial data will be sent from the VB program that the Stamp editor debug utility sends. The data keeps getting sent on an infinate loop because you did not program the stamp to handle it correctly.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Too many lies from the right, which is the wrong side of the tracks.
  • Microman171Microman171 Posts: 111
    edited 2005-11-01 04:48
    Sadly it dosn't work because I push it once and it stays on. I can clear what the VB is sending the stamp though. Can somebody please post the BSII code and the VB exe to make this all work. Very much appreciated.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    1 + 1 = Window

    /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    0............................................0
    0............................................0
    0.(Microman171@hotmail.com)..0
    0............................................0
    0............................................0
    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  • kingnebkingneb Posts: 65
    edited 2005-11-02 08:04
    Did you try to analyze the reason why it is doing that? I had a problem with the debug command doing that once. I sent data in parallel to the right pins on the basic stamp. I fugured it out because I forgot to add a line of code that redirected the data handling when a signal changed.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Too many lies from the right, which is the wrong side of the tracks.
  • Microman171Microman171 Posts: 111
    edited 2005-11-02 17:42
    I have absolutly no idea why it is doing this. jumpin.gif But what I do know is I send the letter once and it goes and goes and goes. I used to have a pause and the goto start but that didn't work very well cry.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    1 + 1 = Window

    /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    0............................................0
    0............................................0
    0.(Microman171@hotmail.com)..0
    0............................................0
    0............................................0
    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  • kingnebkingneb Posts: 65
    edited 2005-11-04 04:18
    Try getting rid of the pause and just the goto start.
  • Microman171Microman171 Posts: 111
    edited 2005-11-06 07:05
    if I use my code then nothing happens and yours has no pauses. Can some really advanced programmer point me in the right direction on how to do this with the debug terminal

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    1 + 1 = Window

    /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    0............................................0
    0............................................0
    0.(Microman171@hotmail.com)..0
    0............................................0
    0............................................0
    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Sign In or Register to comment.