Shop OBEX P1 Docs P2 Docs Learn Events
button — Parallax Forums

button

piezyxwpiezyxw Posts: 9
edited 2011-09-25 15:47 in General Discussion
stupid question but schematics and code for getting a button to turn an led on and off. I think my board is messed but just want to check. Thanks:smile:

Comments

  • graffixgraffix Posts: 389
    edited 2011-09-25 14:39
    oh boy,what kind of board?
  • piezyxwpiezyxw Posts: 9
    edited 2011-09-25 14:40
    board of education. I made a sun tracker with it but im doing something else now and I cant get the button or whiskers to work.
  • Mike GreenMike Green Posts: 23,101
    edited 2011-09-25 15:47
    Check your connections. Look on page 139 of the Basic Stamp Syntax and Reference Manual for schematics and some examples of code for buttons or whiskers.

    Really simple code could be:
    DO
       IF IN5 = 1 THEN
          HIGH 6
       ELSE
          LOW 6
       ENDIF
    LOOP
    
    This would mirror the input state of pin #5 to pin #6. Typically, you'd have an LED with a 1K resistor in series with it between pin #6 (anode) and ground (cathode). You could use either schematic on page 139.
Sign In or Register to comment.