Shop OBEX P1 Docs P2 Docs Learn Events
Sandbox Explanation for Remote Control? — Parallax Forums

Sandbox Explanation for Remote Control?

lardomlardom Posts: 1,659
edited 2014-06-05 09:38 in General Discussion
I wanted to experiment with a 'basic' remote control to test out my code for differential steering. It would be fun to get a robot to accelerate, curve and turn with a remote control. Once I got two LED's to dim independently with two potentiometers I reasoned I could pass those same values with a remote control.
On the Parallax Serial Terminal, except for the volume button, any button I press produces values that look random or that show up as "1".
If the values were constant at least I could use a case statement to reassign a value. Can somebody help me understand what's going on? I'm using Spin.

Comments

  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-06-05 09:13
    If you are getting random values for any button, something is wrong. But focus mainly on what the 0 through 9 buttons are doing. Are they giving random values or do they seem okay?

    It may be that the remote control is using a different code format that the Parallax example (that uses one of the three Sony formats).

    There is a huge list of remote formats and the only good way to find out which other format you are using is to use the software tools in Linux for LIRC (this is one of the reasons I love Linux). But it is easiest to use a Sony Remote Control.

    http://www.lirc.org/

    If you are using just about any IR remote controller, it will transmit a serial code that will be the converted into a integer value to represent the button hit. Many of the IR remote controller buttons are 'one-shot', including those for the channel numbers.. so use 0 through 9 to represent the directions you want to go.

    You can use CASE for each of the above numbers and the robot will move in the direction the number indicates. The center is a 5 and that would be your STOP.


    But be aware that some of the other buttons, such as volume control will repeat transmission as long as you hold down the button. These can be used to increase or decrease speed, or to do other things. You just have to be aware they work differently.

    If you have a really 'full-featured' universal remote, there will be special function buttons that you may just want to ignore. Some of them do fancy things like switch from transmitting to your TV to transmitting to a VCR. That feature would be handy for two robots. Just consider it advanced stuff for latter.

    Try OBEX for sample code. Using a BasicStamp is probably the easiest way to go with an H-bridge driving two motors.
  • lardomlardom Posts: 1,659
    edited 2014-06-05 09:38
    Loopy Byteloose, "one shot". Thanks, that helps a lot. (Once I grasped i2c and keypad scanners I thought I 'knew' it all. I'm not even close!)
    I'll study the Bo_bot ir control for awhile.
Sign In or Register to comment.