Shop OBEX P1 Docs P2 Docs Learn Events
Neat Lil' things from radioshack — Parallax Forums

Neat Lil' things from radioshack

jakjrjakjr Posts: 88
edited 2004-08-04 16:54 in BASIC Stamp
I was at radioshack today and found a few neat things I thought I would share with everyone.

The first was a 10 segment LED bar graph. I hooked it up to my BOE and BS2 using 19 jumper wires and a single 2.2k resitor (2k would have worked as well but I already had some 2.2's laying out). I programed it with this code:

'{$STAMP BS2}
'{$PBASIC 2.5}

DO

 HIGH 6
 PAUSE 1000
 HIGH 7
 PAUSE 1000
 HIGH 8
 PAUSE 1000
 HIGH 9
 PAUSE 1000
 HIGH 10
 PAUSE 1000
 HIGH 11
 PAUSE 1000
 HIGH 12
 PAUSE 1000
 HIGH 13
 PAUSE 1000
 HIGH 14
 PAUSE 1000
 HIGH 15
 PAUSE 1000
 LOW 15
 PAUSE 1000
 LOW 14
 PAUSE 1000
 LOW 13
 PAUSE 1000
 LOW 12
 PAUSE 1000
 LOW 11
 PAUSE 1000
 LOW 10
 PAUSE 1000
 LOW 9
 PAUSE 1000
 LOW 8
 PAUSE 1000
 LOW 7
 PAUSE 1000
 LOW 6
 PAUSE 1000

LOOP


which makes it light up all 10 segments one at a time then turn them off one at a time. Its neat watching the leds growing dimmer while ascending then brighter·while descending.

The second and third things I found was an IR receiver (38khz) and an IR LED, I used the code in this http://www.parallax.com/dl/docs/prod/compshop/tvremote.pdf·text to program them and everything seemed to work great.

By the way, is their anyway to shorten up that code for my 10 segment LED thing?

·

Comments

  • cabojoecabojoe Posts: 72
    edited 2004-08-04 06:34
    x··· VAR··· byte

    Main:

    For x= 6 to 15

    High x

    pause 1000

    next

    for x=15 to 6

    low x

    pause 1000

    next

    GOTO Main


    Post Edited (cabojoe) : 8/4/2004 6:40:08 AM GMT
  • jakjrjakjr Posts: 88
    edited 2004-08-04 16:54
    Thanks for the code, I'm surprised I didnt think of it myself since I was using the same thing a day or two ago. I guess thats what staying up late does to the mind.

    Anyways, I used this code and it worked great, freed up an extra 3% of EEPROM as well.

    pins VAR Byte
    

    Main:
    

     FOR pins  = 6 TO 15
      HIGH pins
      PAUSE 1000
     NEXT
    

     FOR pins = 15 TO 6
      LOW pins
      PAUSE 1000
     NEXT
    

     GOTO main:
    
Sign In or Register to comment.