Shop OBEX P1 Docs P2 Docs Learn Events
L14G3 phototransistor and a continuous rotation servo — Parallax Forums

L14G3 phototransistor and a continuous rotation servo

Mike WMike W Posts: 105
edited 2005-04-22 21:18 in General Discussion
·
I have started experimenting with a L14G3 phototransistor and a continuous rotation servo. The object was that when the transistor sees light it would turn the servo. I programmed the SX/B with the code below, and wired the transistor as shown in the diagram. The project works as I expected with one exception.
My problem is if I touch the 220 ohm resistor between the transistor emitter and the SX pin RC.0 the servo will turn, can anyone explain this to me and help me fix this problem.


Right:
· PULSOUT RA.2, 149, 1······························ ‘ pulse out to servo on RA.2
· PAUSE 20
· RC.0 = 0
· GOTO Main
'
' Program Code
'
Start:
· INPUT RC.0················································ ‘ input from phototransistor
Main:
· IF RC.0 = 1 THEN Right
· GOTO Start



Post Edited By Moderator (Chris Savage (Parallax)) : 4/22/2005 5:53:28 AM GMT
400 x 221 - 5K

Comments

  • BeanBean Posts: 8,129
    edited 2005-04-22 10:57
    You should have a pull-down resistor, from the emitter to ground.
    When the transistor is off, the input is floating (bad).
    Try a 10K then move up or down from there.
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video Display Module" Available Now.

    www.sxvm.com

    "A problem well defined, is a problem·half solved."
    ·
  • Mike WMike W Posts: 105
    edited 2005-04-22 21:18
    Thank You Bean!

    The 10K resistor did the trick I appreciate the help.

    Mike W
Sign In or Register to comment.