Shop OBEX P1 Docs P2 Docs Learn Events
graph led with 10 segments — Parallax Forums

graph led with 10 segments

BadgerBadger Posts: 184
edited 2008-08-22 00:00 in BASIC Stamp
Hello

is there any ware in nuts and bolds that shows a person how to set up an led that shows like a bar graph.
please let me know at this moment dont have time to search need to go to dayton ohio for doc appt. 90 min drive

Phil

Comments

  • ZootZoot Posts: 2,227
    edited 2008-08-21 14:48
    Hook 10 LEDs up to 10 pins of a Stamp. Use 470 ohm resistors and put 5 resistors on one port and 5 on the other (so you don't have too many LEDs pulling current through the Stamp on one port).

    Now you can light 10 leds and do what you want -- which is what? Are you displaying readings from a sensor of some kind, e.g. sound levels, battery charge, tach, what? Just doing cool LED patterns?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
  • BadgerBadger Posts: 184
    edited 2008-08-21 22:34
    Hello Zoot

    thanks for the info. but i dont quite understand about the resistors all being on 2 ports. do you mean like if i put on port 1 to 10 i would put 5 resisters on port 1 and 5 resistors on port 10 .. sorry i am a newbie and i a trying hard so please be patient with me.

    Badger
  • ZootZoot Posts: 2,227
    edited 2008-08-21 23:41
    A port is a "group" of pins -- on the stamp there are two ports -- pins0-7 and pins8-15. Basically you don't want to draw too much current through one group or the other at the same time AND you don't want to draw too much current through all pins all together either.



    pin       resistor (330-470)          LED
    ==>---------------\/\/\/------------<|----------( battery minus)
    
    



    For every LED. Then you can turn them on and off by making all the pins outputs and changing OUTL and OUTH (this lets you set all leds at once).

    Say you have 5 leds on pins 0-4 and another 5 on pins 8-12 with resistors on all of them.

    LedsLeft = OUTL
    LedsRight = OUTH
    
    DIRL = %11111111 ' make all pins outputs 0-7
    DIRH = %11111111 ' make all pins outputs 8-15
    
    Turn_On_all:
      LedsLeft = %00011111 ' remember no leds on pins 5,6,7
      PAUSE 1000
      LedsRight = %00011111 ' other 5
      PAUSE 1000
    
    Turn_On_EveryOtherOne:
      LedsLeft = %00010101 ' remember no leds on pins 5,6,7
      PAUSE 1000
      LedsRight = %00001010 ' other 5
      PAUSE 1000
    
    END
    
    



    Reading the sections in the Pbasic Manual about DIRS, OUTS, INS will help. Plus there are a number of good examples about hooking up an LED so you don't pull too much current through your Stamp.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
  • BadgerBadger Posts: 184
    edited 2008-08-22 00:00
    Hello Zoot

    thanks for the detailed explanation that is really nice.. i am doing this on my own from scratch by reading things as fast as i can. I will review that pbasic manual as you suggested and observe the grouping of pins as you explained..

    again thanks and have a good eve..
    if i have anymore questions i will post them and see what comes back my way

    Bad Badger
Sign In or Register to comment.