Shop OBEX P1 Docs P2 Docs Learn Events
out0 = 1? — Parallax Forums

out0 = 1?

nick bernardnick bernard Posts: 329
edited 2004-11-12 21:50 in BASIC Stamp
Hail all,

i have an existing pcb for an old project that i'm toying with and i cannot seem to get this snippit functioning

i have an led bar graph on the pcb for indication; anode to pin, cathode to sip resistor network thats pulled down...
the led's work fine with TOGGLE L1 commands. but the L1 = 1 type script doesnt werk... what gives? anyone?

rox on
Nick B

'{$STAMP BS2e}
'{$PBASIC 2.5}

L1 PIN 1
L2 PIN 3
L3 PIN 5
L4 PIN 7
L5 PIN 9
L6 PIN 11
L7 PIN 13
L8 PIN 15

ax VAR Byte

DELAY CON 50
Main:
DO
PAUSE Delay
ax = ax + 1
GOSUB Bar_Graph
LOOP


Bar_Graph:
L1 = ax.BIT0
L2 = ax.BIT1
L3 = ax.BIT2
L4 = ax.BIT3
L5 = ax.BIT4
L6 = ax.BIT5
L7 = ax.BIT6
L8 = ax.BIT7
RETURN

Post Edited (nick bernard) : 11/12/2004 9:48:31 PM GMT

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-11-12 21:48
    You need to make your pins outputs (TOGGLE does that "under the hood"). You can do it with one line of code:

    DIRS = %1010101010101010

    A "1" makes the pin an output, "0" an input. Put this line of code before Main.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • nick bernardnick bernard Posts: 329
    edited 2004-11-12 21:50
    HAIL JON

    wow super fast...

    uber cool jon will do

    thx a mil
    nick B
Sign In or Register to comment.