Shop OBEX P1 Docs P2 Docs Learn Events
Hello Noob looking for help — Parallax Forums

Hello Noob looking for help

jason0627jason0627 Posts: 17
edited 2013-12-21 12:54 in BASIC Stamp
Hello so i am just learning basic stamp and i have a question i was hoping you could help me on

this is regarding bicolor led diode

so i have a basic stamp 2 and my set up is like this

p14 connected to resistor ... then connected to led (anode) then connected to p15

now the idea is current flows from p14 through resistor then diode to p15.

i write the code

do

high 15
low 14 pause 1500

low 15
high 14
pause 1500

low 15
low 14
pause 1500

loop

now it does exactly what i want (goes from green to red then off and loops)

but i was wondering what would happen if i took out the low part of the code. The practice still worked but i became concerned as to where the current was ultimately flowing. since i did not state it should go to low (ground) where is it going. my guess is that since it is connected to the i/o of the processor then it is going back to it. does this hurt it?

thanks

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2013-12-21 12:06
    Consider the diode and the resistor together as one device with two terminals. To show red, one terminal has to be connected to a positive terminal of a power source (high in your case) and the other terminal has to be connected to the negative terminal of the power source (low in your case). To show green, you swap polarities with the first terminal connected to negative (low) and the second terminal connected to positive (high). If both diode/resistor terminals are connected to a positive terminal or both terminals connected to a negative terminal, nothing lights and no current is drawn (because the voltages are the same ... a basic rule of electrical theory). Internal to the Stamp, an I/O pin set to output high is connected to the +5V power source and an I/O pin set to output low is connected to the 0V (ground) power source. Does this help?

    An I/O pin set to input mode won't supply any current and, in fact, represents a very high resistance connected to a circuit that detects voltages above roughly 2V
  • jason0627jason0627 Posts: 17
    edited 2013-12-21 12:27
    Hi mike thanks for the help that does clear somethings up for me. I tried to replicate what i thought happened (by taking out the low command) and it did not work (i probably thought i commented them out when i did not). I assume because of what you said before of both being set to positive terminal.

    while i have you one (or anyone else glad to answer) more easy question.. i am using a bread board and and i am being careful not to allow the wires to touch (say a resistor is close to that diode) . does the touching of the wires cause a connection i should be worried about or does the breadboard provide a more favorable connection for the current to follow. (again i am not trying to make a connection this is for future reference when im sure more wires will be on the board an accidental touching could occur)

    thanks again and i consider my first question answered.
  • Mike GreenMike Green Posts: 23,101
    edited 2013-12-21 12:51
    When wires touch you have a connection unless the wire is insulated (with a non-conductor like plastic) at that point. The connection may not be a good one, but it's a connection. The wires may touch only intermittently or the touch may be so light that there's a small resistance present from skin oils on the wire or other "junk" or the touch may be so light that only a few small spots are touching. An "accidental touch" of one bare wire to another can instantly destroy an expensive chip if the touch causes too high a voltage to be applied to the chip or a reversed supply voltage to be applied. Keep your breadboard reasonably neat and, if you plan to use the circuit for any length of time, trim the excess wire off the parts used or slide insulation over the uninsulated wires so "accidental" touches are not likely to occur.
  • jason0627jason0627 Posts: 17
    edited 2013-12-21 12:54
    thanks mike that answers my question. was wondering if accidental touch could really mess something up.. seems the answer is yes. been very helpful hope you have a nice weekend.
Sign In or Register to comment.