Shop OBEX P1 Docs P2 Docs Learn Events
Program check? Plz help — Parallax Forums

Program check? Plz help

Benbo231Benbo231 Posts: 26
edited 2009-01-16 12:48 in BASIC Stamp
·have a robot with 2 switches hooked up into ports 1 and 2 on the BOE.

I am using Variables
btn1
btn2

and this coding for the checking of the switches

BUTTON 1,0,255,250,btn1,0,noswitch for switch 1
BUTTON 2,0,255,250,btn2,0,noswitch for switch 2

it does not recognize either of them when I try them

any advice?burger.gifburger.gifburger.gifburger.gifburger.gifburger.gifburger.gifburger.gifburger.gifburger.gifburger.gifburger.gifburger.gifburger.gifburger.gif

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Someday Monkeys will rule the world. Then you'll be the first to go!

Post Edited (Benbo231) : 1/17/2009 1:46:55 AM GMT

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-01-16 00:09
    How are your switches connected? You need to have a pullup or pulldown resistor depending on how you've got the switch connected. The "What's a Microcontroller?" tutorial shows how.
  • Benbo231Benbo231 Posts: 26
    edited 2009-01-16 00:54
    i have a pulldown resistor for both-they both work when it only checks one btn-btn1

    but it only hits one reaction sequence

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Someday Monkeys will rule the world. Then you'll be the first to go!
  • Mike GreenMike Green Posts: 23,101
    edited 2009-01-16 01:18
    Since you only gave the two BUTTON statements, it's impossible to tell how they're used. Keep in mind that they have to be executed repeatedly for the debounce and repeat stuff to work. You want them to branch to your action code when the button is pressed and otherwise repeat both (if neither one is pressed).
  • jdpetersdocjdpetersdoc Posts: 26
    edited 2009-01-16 03:43
    Why not use the IF & THEN statement

    IF (IN1 = 1) AND/OR (IN2 = 1) THEN

    GOSUB Routines here



    ELSE

    ENDIF
  • Benbo231Benbo231 Posts: 26
    edited 2009-01-16 12:48
    heres my program-can you proofread it plz?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Someday Monkeys will rule the world. Then you'll be the first to go!
Sign In or Register to comment.