November 24, 2024, 12:16:40 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.


LED programing question

Started by imagineerdan, September 24, 2007, 02:10:14 PM

Previous topic - Next topic

JonnyMac

Chances are that the IR receiver has an active low output.  It would be best to test that independently -- then connect it to your program once you understand.  Remove the SETUP jumper from P6 and connect the receiver -- make sure you get the connections right.  Then run a very small test program:

Main:
  DEBUG PIN6, CR
  GOTO Main


I suspect you're going to see 1s on the screen until you press the button on your remote, then it will go to 0s -- let me know what happens and I'll update your program.  It's a very important lesson: don't just add new items willy-nilly; take the time to understand new circuits and sensor before you connect them to a working prop.

Jon McPhalen
EFX-TEK Hollywood Office

imagineerdan

Thanks Jon, you are right it stays 1's then goes to 0's.

JonnyMac

September 30, 2007, 05:52:20 PM #17 Last Edit: September 30, 2007, 05:53:57 PM by JonnyMac
Okay, we just need to change the polarity on the trigger inputs.  Add these lines to the constants section:

SYMBOL  IsActive        = 0                     ' for IR sensors
SYMBOL  IsNotActive     = 1


... and then update the top of the main loop like this:

Main:
  RANDOM lottery                                ' stir random value
  IF Trigger1 = IsActive THEN Show_1            ' wait for trigger
  IF Trigger2 = IsActive THEN Show_2
  GOTO Main


Finally, move the P6 and P7 SETUP jumpers to the UP position (since we're now using an active-low input).
Jon McPhalen
EFX-TEK Hollywood Office

imagineerdan

Ok That works great, now I am modifying my plans to have the program triggered by a 38 khz IR ic and also a contact closure. I did this and changed the part of the code where the active high and low inputs are and it works, but I am getting a lot of false triggering from the contact closure pin. How would I fix this with the REV Dx modual which doent have the jumpers like the prop-1.

JonnyMac

You need to add a pull-up or pull-down to your Rev Dx -- there is no way around it; a floating input pin will never be reliable.
Jon McPhalen
EFX-TEK Hollywood Office

imagineerdan

Would I do that with a set of resistors, how would this be wired in?

JonnyMac

October 02, 2007, 06:45:47 PM #21 Last Edit: October 03, 2007, 06:53:54 AM by JonnyMac
Like this (both configurations shown).  On the Prop-1, the SETUP jumper is the 10K, and the 220 is built into the board.  It should be clear that Vdd= 5 VDC and Vss = ground.  You may want to add 3-pin headers to your BS1 to make it easy to connect things to.  Parallax sells the headers in their parts store.






Update: Corrected an error spotted by my friend, Randy.
Jon McPhalen
EFX-TEK Hollywood Office

randyaz

October 02, 2007, 10:08:01 PM #22 Last Edit: October 02, 2007, 10:10:51 PM by randyaz
Quote from: JonnyMac on October 02, 2007, 06:45:47 PM
.....It should be clear that Vss = 5 VDC and Vss = ground.... 

Shouldnt that read...

Vdd = 5 VDC and Vss = ground


...I hope we're not working Jon to hard   ;D

livinlowe

Just look at his picture! He's falling apart!  ;D
Shawn
Scaring someone with a prop you built -- priceless!

JonnyMac

Thanks for the catch, Randy -- and now that the phone is ringing at 6 AM I'm going to get even prettier!
Jon McPhalen
EFX-TEK Hollywood Office