Can BS2 create continuity programmatically?
<!--StartFragment -->Can BS2 create continuity programmatically?
i have used my BS2 to blink a led, beep a speaker, spin a servo, etc but these all seem to send power to the i/o pin. (not sure if freqout and pulse are power)
i basically have a button (the continuity problem)·that i want my BS2 to activate via code / program.· i have soldered two wires, one on each side of the button in question, and when i physically cross these wires·by hand (touch red wire to black wire) the button activates and a drawer opens.
how can i have the BS2 activate the button?· i don't have any code really·because i am a little hesitant to hook up button to stamp for fear of frying the drawer and/or motor that it opens. but i thought maybe:
Main:
IN3 = 0 ' wire are
IN5 = 0 ' uncrossed
DEBUG "Opening Drawer..."
IN3 = 1 ' wires are
IN5 = 1 ' crossed
IN3 = 0 ' button up wires
IN5 = 0 ' are uncrossed
' Fast on off to simulate single push button (crossing red with black?)
DEBUG "Drawer Now Open"
PAUSE 5000
DEBUG "Closing Drawer..."
IN3 = 1
IN5 = 1
IN3 = 0
IN5 = 0
DEBUG "Drawer Closed"
END
i have used my BS2 to blink a led, beep a speaker, spin a servo, etc but these all seem to send power to the i/o pin. (not sure if freqout and pulse are power)
i basically have a button (the continuity problem)·that i want my BS2 to activate via code / program.· i have soldered two wires, one on each side of the button in question, and when i physically cross these wires·by hand (touch red wire to black wire) the button activates and a drawer opens.
how can i have the BS2 activate the button?· i don't have any code really·because i am a little hesitant to hook up button to stamp for fear of frying the drawer and/or motor that it opens. but i thought maybe:
Main:
IN3 = 0 ' wire are
IN5 = 0 ' uncrossed
DEBUG "Opening Drawer..."
IN3 = 1 ' wires are
IN5 = 1 ' crossed
IN3 = 0 ' button up wires
IN5 = 0 ' are uncrossed
' Fast on off to simulate single push button (crossing red with black?)
DEBUG "Drawer Now Open"
PAUSE 5000
DEBUG "Closing Drawer..."
IN3 = 1
IN5 = 1
IN3 = 0
IN5 = 0
DEBUG "Drawer Closed"
END
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
"depending on what cuttent flows you could use a transistor, mosfet or relay."
the current is that of a pc dvd drive 5v / 12v
"A better way would be to find out what the button was activating and power that direct (or with the transistor, mosfet or relay)"
i don't know if this is possible as the button activates the eject.·· doesn't the drives firmware decide what happens when the buttons pressed (open drawer), how long the motor runs, etc...?
and for the record (don't know if it matters) i would ultimately want to put this with the PIR motion sensor to create the short across the wires.· but as a test i just went with a fast open.. pause.. close.. loop.
To open a CD drawer, that would be overkill. By nine or ten orders of magnitude. Drop by your nearest Radio Shack or other source of parts and buy a 5V reed relay. These do the same thing. Just a lot slower. The equivalent of the 'gate' is very small coil. When you apply 5V from a stamp pin to that coil, it creates a magnetic field that draws together two very small (hence 'reed') pieces of metal. That closes the connection. You have a switch.
Relays come in ratings for difficult levels of current traveling through that circuit. Too much current you melt the contacts together and they won't turn off. Even more current and you simply melt the whole switch. If you ever want to turn on the motor of a garage door opener or the motor of a golf cart, come back and learn about that level of current. Again, not an issue with the drawer of a CD player.
Buy any reed relay you like, so long as it says "5V Coil Rating" or something similar. Put a 220 ohm resistor from your Stamp pin to the indicated "plus pin" for the coil·on the relay. Connect the other pin from the coil to ground. Now the other two pins are your "crossed wires". There you have· it.
Wire in series Vdd----switch----10K----Vdd. From where switch and resister join, wire IN[noparse][[/noparse]PIN]; IN[noparse][[/noparse]PIN] will now take value from switch. Open switch reads a 0, closed reads 1, as:
IF IN[noparse][[/noparse]PIN]=0 THEN
{CODE}
ELSE
{CODE}
ENDIF
Complete diagram and description on page 62 of "Applied Robotics with the SumoBot" available at description of SumoBot.
Again, sorry to muddy the water if I mis-read.