COOL!
What was the problem before?
COOL!
What was the problem before?
Dave
Always wear safety glasses while programming.
Thanks, the reason it wasn't working was because pin 3 was not going to positive so for some reason the led kept being on but once I supplied the 5 volts + to pin 3
it worked.
Thanks, Good info.
Dave
Always wear safety glasses while programming.
Yeah actually your right
it was pin 1 that I supplied the + to because pin 3 goes to ground
Sorry my mistake
This is the code I made do you think this might work?IRLED1 var PORTB.0
Servo var PORTB.1
TRISB=%00000001
Loop:
If IRLED1 =1 then
Pulsout 0,130
pause 10
pulsout 0,150
else
pulsout 0,150
endif
Goto Loop
End
Basically I want it to read the input and if the proximity sensor is activated then have it move the servo all the way to the right or left.
To find the center of the servo
I knew that dead center was 1.5ms and since I am using a 4mhz crystal the time interval of PULSOUT is in units of 10 us.
So I used this equation to find my pulse
1.5ms = 1500us
and then 1500/10= 150
and clockwise is 1.3ms so I did the same equation for that
Can not comment about the servo, I do not know which one you are using.
In your code
Change
Pulsout 0,130
to
Pulsout Servo,130
Use either the full pin name ( PORTB.0 ) or the var assigned to it. Works much better I think.
Dave
Always wear safety glasses while programming.
Bookmarks