Shop OBEX P1 Docs P2 Docs Learn Events
Newbie inputs question: — Parallax Forums

Newbie inputs question:

VeramacorVeramacor Posts: 6
edited 2007-10-22 12:49 in BASIC Stamp
Hello,

Just purchased the BS2 OEM version. Real simple program test of PIN0. I connected a 9 Volt battery + to Vin - to Vss.


' {$STAMP BS2}
I VAR Word

INPUT 0
FOR i = 1 TO 10
DEBUG ? IN0
NEXT



The debug window shows:
0
1
1
1
0
1
1
0
0
0


Almost random reading of the input pin - nothing is connected to PIN0 why the random reading?

Thanks!
Jeff

Comments

  • ForrestForrest Posts: 1,341
    edited 2007-10-22 12:49
    The inputs are 'floating' - picking up random noise. Use pull-down or pull-up resistors on the circuit to prevent this condition. You may want to scan the 'What's a Microcontroller' text (free download) here for background and simple experiments www.parallax.com/detail.asp?product_id=28152
Sign In or Register to comment.