pulsout...servo...LEDs


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2009
    Location
    Warrenton Mo
    Posts
    7

    Default pulsout...servo...LEDs

    While learning about pulsout useage, I added LEDs to parts of my simple servo control program. I got the servo moving just fine, but the LEDs never come on. Using an 84A and LEDs on B.4-B.6 and servo on B.0. Push buttons on A.0 and A.1. with pulldown resistors. This is where I am...

    define osc 4
    j var byte:speed var byte: portb=0:trisa=%00011
    speed=50: porta.2=1' power to pic is on LED
    main:
    portb.6=1: portb.0=0' input loop LED on and clear servo pin
    if (porta.0=1 and porta.1=1) then autosweep
    if porta.0=1 then portb.4=1: pulsout portb.0,200: pause speed: portb.4=0:goto main
    if porta.1=1 then portb.5=1: pulsout portb.0,70: pause speed: portb.5=0:goto main
    portb.6=0:goto main
    autosweep:
    portb.4=1:for j=1 to 30: pulsout portb.0,200: pause speed:next j: portb.4=0
    portb.5=1:for j=1 to 30: pulsout portb.0,70: pause speed:next j: portb.5=0
    if porta.0=1 then main
    if porta.1=1 then main
    goto autosweep
    end

    None of the LEDs light while in the loops. Why? The servo works fine.
    The more I think about it the worse off I am

  2. #2
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Re: pulsout...servo...LEDs

    just for fun try this:
    Code:
    speed=50: porta.2=1' power to pic is on LED
    portb.4 = 1
    portb.5 = 1
    portb.6 = 1
    pause 2000
    main:
    This way you have a 2 second all on to verify they all work, it will also tell you what loop turned them off (i think). If they both go off, its autosweep, else if only 1 goes off its the first part
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts