Shop OBEX P1 Docs P2 Docs Learn Events
IR Remote — Parallax Forums

IR Remote

I have learned to use the ir remote control to write keys to the debug terminal. I need help choosing a key on the remote and using that choice to activate a remote device, such as a transistor. As you can see, I'm a willing student.

Thanks,

Flasher

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    If you post the code you're using to display keys on the DEBUG screen we can show you how to make adjustments to take some other action. Please use the code tags when posting or attach your code to your reply.
  • I am using the code associated with the IrRemotecodeCapture.bs2.
    My object is to punch in a number and use the output from the remote to control a circuit remotely.

    Thanks,

    Flasher
  • There's an example starting on PDF page 83 (print page 73).

    https://www.parallax.com/downloads/ir-remote-boe-bot-text
  • ercoerco Posts: 20,257
    Congrats, flasher, you stand on the brink of as whole new world. I still remember when I got my BS2 to respond to an IR remote. It was magic then, and I still think it's a great way to control a project. The world has gone mad for Bluetooth and WiFi, but a simple IR remote is just as powerful IMO.

    Now that you have your program reading the remote and debugging, start adding IF checks within your loop to branch to a program segment or subroutine that does what you want. Pseudo code:
    main:
    
    <insert routine for reading IR, store value as variable B0>
    
    IF B0=20 THEN aaa  ' if MUTE button, go to label aaa
    IF B0=21 THEN bbb ' if POWER button, goto label bbb
    goto main
    
    aaa:              ' label aaa, comes here if mute button pressed
    HIGH 1         ' make pin1 high (on)
    GOTO main  ' go back to main loop
    
    bbb:             ' label bbb, comes here if power button pressed
    LOW 1          ' make pin1 low (off)  
    GOTO main  ' go back to main loop
    
  • Thanks, ERCO. My first project using the IR Remote was to trigger a transistor in a circuit located in a bird feeder in the front yard. The transistor would operate a relay. On down the chain to cause a servo to release a golf ball suspended on a string. The golf ball swings like Tarzan and slams against the bird feeder and scares away the squirrel.
  • Cool! How do you retract the golf ball?
  • ercoerco Posts: 20,257
    Fantastic! You got much farther than this fellow, demonstrating "IR Support". :)


Sign In or Register to comment.