Make a directory inside your “tessel-code” folder called “relay”, change directory into that folder, and initialize a tessel project:
mkdir relay; cd relay; t2 init
If you have something to turn on and off with the Relay module, cut the power wire, strip the ends to expose the wire, and insert the two exposed ends into port 1 on the Relay module. (If you don’t have something to plug in at the moment, you can still continue; you won’t see anything turn on or off, but the relay makes an audible clicking noise when it latches.)
Plug the relay module into Tessel port A with the hexagon/icon side down and the electrical components on the top, then plug Tessel into your computer via USB.
Install by typing npm install relay-mono
into the command line.
Rename “index.js” to “relay.js” and replace the file’s contents with the following:
Save the file.
In your command line, t2 run relay.js
Turn some things on and off with code! This gif shows clap-activated lights which use the ambient and relay modules together.
Bonus: Change the code to toggle only one relay channel, every 10 seconds.
To see what else you can do with the relay module, see the module docs here.
What else can you do with a relay module? Try a community-created project.
What are you making? Share your invention!
If you run into any issues you can check out the relay forums.