Shop OBEX P1 Docs P2 Docs Learn Events
Controlling the Relay — Parallax Forums

Controlling the Relay

debonenedebonene Posts: 19
edited 2009-12-06 23:31 in BASIC Stamp
Please is there anyone that knows the right syntax code to use to switch the poles of a relay. Am using a single pole double throw relay.


This is my code: My input pin is connected to port 11 and the··ground is connected to VSS using a basic stamp board 2·but it is not sending any voltage to the relay to switch the poles so am guessing it is my code.···

Main:
·· HIGH 11
·· pause 500
·· LOW· 11
···Pause 500
·· GOTO Main
··

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-12-06 23:31
    There's nothing wrong with your code.

    Most relays require more current than a microcontroller like a Stamp can supply. You need to use a switching transistor and a diode to prevent the relay from damaging the Stamp's I/O pin. Go to the main Parallax page and click on the Resources tab. You'll get a list of links. Click on the "Nuts and Volts Columns" link and locate and download Column #6. That discusses how to use a Stamp to control relays and small motors. The schematic on the last page of the article shows one simple example of what you need.
Sign In or Register to comment.