L14G3 phototransistor and a continuous rotation servo
Mike W
Posts: 105
·
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
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
Comments
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."
·
The 10K resistor did the trick I appreciate the help.
Mike W