Shop OBEX P1 Docs P2 Docs Learn Events
Info needed on switching — Parallax Forums

Info needed on switching

MovieMakerMovieMaker Posts: 502
edited 2009-06-10 22:49 in Robotics
I am working on a project that will light up some LEDs.· If I hit the switch one through eight times , it will cycle through different patterns then come back to pattern one.·The switch is hard wired. It has one side to ground and a 1k ohm Resistor hooked to the other side to the input of the controller chip. What I intend to do is instead of hitting the switch to change the pattern by hitting it more than once, I would like to hook it to the basic stamp and just pull it to ground for the number of times until I get the desired effect.· I also plan to take the "switch" out of the circuit completely and select individual patterns instead of using them cycling through.· An example would be, I would like to use 3 then 5 then 1 then 2, etc. Instead of 1,2,3,4,5,6,7,8 all in a cycle. Hope I am making myself clear.· I was wondering if 1k ohm is enough of an isolation to the stamp.

Thanks in advance for your information.

tongue.gif·

Comments

  • SRLMSRLM Posts: 5,045
    edited 2009-06-10 01:35
    MovieMaker said...
    I would like to hook it to the basic stamp and just pull it to ground for the number of times until I get the desired effect

    Do you mean to hold it?
  • MovieMakerMovieMaker Posts: 502
    edited 2009-06-10 01:43
    I am not sure I know how to express what I am trying to say.·· There are 8 patterns that go through a PIC chip. One Input Pin.· It has a physical button on it. If you press the button 8 times you get the last pattern. If the nineth time is made, it goes back to the first pattern. I need to simply emulate pressing the button. Because if I just simply hold the button, it will cycle through all patterns, I believe. If I just press it three times, it will wind up on the third pattern.· I want to randomly select patterns.



    hope I was clear enough.
  • kwinnkwinn Posts: 8,697
    edited 2009-06-10 03:43
    This is probably what you want. The resistors should be around 10K to 47K, and the push button needs to be debounced.
  • MovieMakerMovieMaker Posts: 502
    edited 2009-06-10 14:39
    I guess I am not being clear. I want the stampII to be the push button.
  • SRLMSRLM Posts: 5,045
    edited 2009-06-10 16:06
    So you could just connect the two (the BS2 and PIC) via a series resistor, right? Are you looking for programming help or hardware help?
  • MovieMakerMovieMaker Posts: 502
    edited 2009-06-10 22:19
    I don't rightly know. I have a pic that has a 1k resistor tied to an input pin that is connected to a switch. Then, the other side of the switch is going to ground. When I hit the switch, it cycles through 8 different patterns. I simply want to take the switch completely OUT of the circuit and trigger it with the basic stamp through software. It doesn't really seem like a big deal, but I don't want to overload or burn something up. I guess I am asking is it ok to hook the output pin directly from the basic stamp to the switch? Remember, the switch has a 1k ohm resistor on one side and ground on the other.
  • SRLMSRLM Posts: 5,045
    edited 2009-06-10 22:35
    You could completely take the switch out by connecting an output pin of the BS2 to the switch input pin of the PIC. Then, you simply have the BS2 output low for a press, and high for normal.
  • MovieMakerMovieMaker Posts: 502
    edited 2009-06-10 22:39
    that is Exactly what I was thinking about doing. Simple. But complicated to explain. You see, it is a toy that shows eight different emotions. I want to program it into the robot so he can smile, frown, etc. Thanks for your answer. That is what I wanted to hear.
  • SRLMSRLM Posts: 5,045
    edited 2009-06-10 22:47
    Forgot to mention that you'd probably want to leave the series resistor in there to prevent problems.
  • MovieMakerMovieMaker Posts: 502
    edited 2009-06-10 22:49
    I plan to only take out the two contacts of the switch. Connect up to ground and then an output pin to the other pin on the switch.

    What do you think, Mike?
Sign In or Register to comment.