Shop OBEX P1 Docs P2 Docs Learn Events
Defective or Working BASIC Stamp — Parallax Forums

Defective or Working BASIC Stamp

FwissFwiss Posts: 13
edited 2010-02-01 16:28 in BASIC Stamp
I was using the Board of Education, (So I don't know if this is the right place to post) and used the following code to see how it got input:s
' {$STAMP BS2}
' {$PBASIC 2.5}

DO
DEBUG CRSRXY, 0, 3,
BIN1 IN6, BIN1 IN5, BIN1 IN7, BIN1 IN4
PAUSE 100
LOOP

(Just something I got from the BOE-Bot Book)

I had nothing plugged in, and sometimes it gave 1101, others it gave 1111 another 0000, but nothing plugged in. When I removed it from the wooden table, (It had rubber legs so it didn't even contact the table) The voltage input data changed. Is this defective or normal?

Comments

  • allanlane5allanlane5 Posts: 3,815
    edited 2010-02-01 15:56
    If you have nothing tied to an input pin, and then read that input pin, it acts like an antenna. Usually, it picks up the 60Hz 'noise' from power lines. So yes, this is normal.

    This is why people use 10K ohm pull-up, (or pull-down) resistors to give a definite 'default' value on input pins, even when the driver is disconnected. I say "driver", because USUALLY when you're reading an input pin, you expect it to be 'driven' by some driver output somewhere -- otherwise you wouldn't be reading it.
  • FwissFwiss Posts: 13
    edited 2010-02-01 16:28
    Good, so it's not messed up! Thanks, that was very helpful.
Sign In or Register to comment.