November 23, 2024, 09:02:23 PM

News:

You can now use Vixen to program your Prop-1 and Prop-2 controllers!  Get started quickly and easily, without having to learn PBASIC.  Details in the Library forum.


Program for my prop1

Started by Lynn, January 21, 2010, 01:56:58 PM

Previous topic - Next topic

JonnyMac

March 19, 2010, 09:44:07 AM #15 Last Edit: March 19, 2010, 01:08:15 PM by JonnyMac
Yes, if you're connecting to Px.W and Px.B (the male header pins).  That said, you should put a resistor in the circuit as well.  I typically use 470 Ohms on a 5v circuit, but the Prop-1 has a 220 built in so you can use another 220 (total of 440 Ohms will be fine).

[Edit] Corrected per Shawn's catch!  Led should connect to Px.W (the anode side) and Px.B (the cathode side -- flat spot on LED).
Jon McPhalen
EFX-TEK Hollywood Office

Lynn

I have the resistor in place.....   but the led stays lit through the whole routine.

livinlowe

I'm sorry if I am not helping, but shouldn't the LED go to the White and Black? White-from processor; Red-+5V DC; Black - Ground?
Shawn
Scaring someone with a prop you built -- priceless!

Lynn

Guess I was only guessing on the red and white.  So I really am not sure.

I've tried connecting to the white and black but it stayed on there too!

JonnyMac

This thread is getting long-winded -- you'll have to repost the code that is creating the problem.  BTW, Shawn is correct: the LED should connect between Px.W and Px.B.  I corrected my errant post, above.
Jon McPhalen
EFX-TEK Hollywood Office

JackMan

Try connecting your LED to OUT2 instead of PIN2. Connect the NEG leg of the LED to OUT2 and the POS leg to V+ with the 470 ohm resistor. Put the power switch on position 2. Hope this helps ya out.  ;)

JonnyMac

Depending on your application you may want to bump the resistor up to 1K.
Jon McPhalen
EFX-TEK Hollywood Office

JackMan

True, it does depend on the particular LED being used and the supply voltage to the Prop-1. I assumed the voltage was 12v in this case.  With a typical 2.2v LED, a 470 ohm resistor would be fine. (One should never assume  :D) It never hurts to go with a higher resistor but if the value is too high the LED will be dimmer than normal. Here's a great site for calculating LED resistor values for anyone interested. Once your at this page you can save it as Web Page, complete (*.htm; *.html) and it will work without having to go online every time you need a calculation.

http://www.laureanno.com/RC/LED-calc.htm

Lynn

The voltage is 9v.
I'll try the out2.

And since connecting to the whi and red pins....   The led does not light at all.

I checked it and the LED is fine.

I can repost this with the code if needed.

JonnyMac

You should be connecting the LED between the white and black pins -- I corrected my early post.

You've got two choices when controller LEDs:

1) Connect the anode (+) side to Px.W (white) and the downstream side of the current limiting resistor to Px.B (black).  When the pin, Px, is HIGH, the LED will light.

2) Connect the anode (+) side to V+ (input voltage when power switch is in position 2) and the downstream side of the current limiter to OUTx.  When Px is HIGH, the LED will light.
Jon McPhalen
EFX-TEK Hollywood Office

JackMan

QuoteAnd since connecting to the whi and red pins....   The led does not light at all.

I checked it and the LED is fine.

Lynn,
      This is a bit confusing. In you previous posts you stated that your LED stayed lit constantly when connected to P2(W) and P2(R). After reconnecting to P2(W) and P2(B) you again said the LED stayed lit. Something is not adding up.  :-\

Lynn

I'm sorry,  I had kinda miss spoke... 

When  the LED is connected to the white and black wires,  it does not come on.

I met Jon at Transworld so I an going to try something...   Well see how that goes.
If PIN2 works and will blink while running another program,  then I will see what needs done with this program.

Lynn

Jon,
I tried what you suggested and the LED worked like a charm.
Still wont come on running the drop head program.

I can start a new thread if you want and add the program as I have it....
Or I can put it here.
You had mentioned about starting a new thread a while back and will do that if needed.
Lynn

JonnyMac

Go ahead and put the code here -- now that we know the LED works the code will be easy to fix.  Since we're so far into this thread, please provide an updated description of what you want; that way I can sort out where the code isn't doing what it should.
Jon McPhalen
EFX-TEK Hollywood Office

Lynn

2 servos,   with one connected to the side of a continuous rotation servo.

When triggered with a mat,  light comes on and servo 1 turns 45 degrees dropping a string that is on servo 2.  After a 3 second pause, the light goes out and servo 1 turns back to its starting position, and servo 2 rolls up the string.

All works great except the light never comes on.
------------------------------ I/O Def--------------------
SYMBOL   Trigger               = PIN6                                          ' SETUP = DN

SYMBOL   Light                  = PIN2
SYMBOL   Rotate               = 1                                                 ' rotation servo
SYMBOL   Tilt                     = 0                                                 ' tilt servo

--------------------------constants -------------

SYMBOL   IsOn                  = 1                                                  ' for active-high in/out
SYMBOL   IsOff                  = 0
SYMBOL   Yes                    = 1
SYMBOL   No                     = 0

------------------variables-----------

SYMBOL   timer                  = B2
SYMBOL   pos                    = B3                                                          ' tilt servo position
SYMBOL   speed                = B4                                                          ' rotation servo speed
SYMBOL   delay                 = W5

----------------------------initialization ---------------------
Reset:
    PINS - %00000000
    DIRS - %00000111
 
    pos - 100
    speed = 155

    delay = 40000
    GOSUB Servo_Pause

------------------program code---------------------------------

Main:
    timer = 0

Check_Trigger:
    PULSOUT Tilt, pos
    PULSOUT Rotate, speed
    PAUSE 17
    timer - timer + 20 * Trigger
    IF timer < 100 THEN Check_Trigger

Light_On:
    Light = IsOn
    Delay = 500
    GOSUB Servo_Pause

Drop:
    pos = 200
    delay = 3000
    GOSUB Servo_Pause

Roll_Up:
    Light = IsOff
    pos = 100
    speed = 125
    delay = 11000
    GOSUB Servo_Pause

    GOTO Reset

----------------subroutines--------------

' Use instead of PAUSE
' -- put pause value (ms) in "delay" before calling

Servo_Pause:
    PULSOUT Tilt, pos
    PULSOUT Rotate, speed
    IF delay < 20 THEN SP_Exit
        PAUSE 17
        delay = delay - 20
        GOTO Servo_Pause

SP_Exit:
    PAUSE delay
    RETURN