IR sensor application
erict15
Posts: 3
I am wondering if it is possible to use the BASIC Stamp with an IR sensor to send a command to a program (for example, send the play command to media player).
Currently, I am using this code from Parallax:
What I want to do (in pseudocode):
IF P0=1 THEN play_music()
I looked at www.lirc.org/ and that gives an idea of what I want to do, but is much more advanced. Does anyone have any ideas on how to implement this?
Currently, I am using this code from Parallax:
' ========================================================================= ' ' File...... PIR_Simple.bs2 ' Purpose... Show Output State Of PIR Sensor ' Author.... Parallax, Inc. ' E-mail.... support@parallax.com ' Started... 12-14-2005 ' ' {$STAMP BS2} ' {$PBASIC 2.5} ' ' ========================================================================= ' -----[noparse][[/noparse] Program Description ]--------------------------------------------- ' This program displays the current state of the PIR Sensor connected to P0 ' on the DEBUG screen. ' -----[noparse][[/noparse] Program Code ]---------------------------------------------------- Main: DO DEBUG HOME, BIN1 IN0 ' Display Status Of P0 At Home Pos. PAUSE 100 ' Small Delay LOOP ' Repeat Forever
What I want to do (in pseudocode):
IF P0=1 THEN play_music()
I looked at www.lirc.org/ and that gives an idea of what I want to do, but is much more advanced. Does anyone have any ideas on how to implement this?
Comments
Whether you can control your media player depends on what kind of media player you have. There are several MP3 players that can be controlled directly by a microcontroller like a Stamp. The Vinculum VMusic2 is one example (Google "Vinculum VMusic2") that I've used for a sequenced sound player. You can also take other MP3 players, take them apart, solder wires across the play button switch (and possibly other buttons), and use a reed relay to close the switch contacts with the relay controlled by the Stamp.