Is this safe? RC Time to detect ON/OFF
Luis_P
Posts: 246
Hi, I need to know if my setup will not damage the Bs2 or my Mp3 player. I needed to detect when a song start playing on my Mp3 player. The player board has an LED that is ON when the song starts, I soldered one leg of the LED to pin 1 (bs2) and ground (mp3 player) to ground (5V- bs2). Everything work perfect with the code below, when reads 1 do something, when reads 0 do something else. Is working! But how long will last? It will damage either the pin or the LED on Mp3 player board?
GRACIAS!
Code:
X var word
dirs =$ffff do I need this?
DO
pause 500
RCtime 1,0,X
low 1
IF X = 0 goto routine1
IF X = 1 goto routine2
LOOP
connections:
BS2 pin 1
LED mp3 player (only one side, do know if cathode or anode the LED is surface mounted)
BS2 VSS
GND ( is the ground connection on the mp3 player board)
GRACIAS!
Code:
X var word
dirs =$ffff do I need this?
DO
pause 500
RCtime 1,0,X
low 1
IF X = 0 goto routine1
IF X = 1 goto routine2
LOOP
connections:
BS2 pin 1
LED mp3 player (only one side, do know if cathode or anode the LED is surface mounted)
BS2 VSS
GND ( is the ground connection on the mp3 player board)
Comments
Also, why are you using RCTIME? Why not just see if the pin (as an input) is high or low? I would also put a 220ohm or so resistor between the LED pin at the Stamp pin to protect the Stamp in the event the pin is made an output (inadvertently).
that to keep using the RC-Time code?