This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
digispark:tutorials:relay [2013/03/29 06:55] PeterMortensen [Product Description:] Copy edited. |
digispark:tutorials:relay [2016/06/09 12:03] (current) |
||
|---|---|---|---|
| Line 15: | Line 15: | ||
| | 3.5mm pitch 2-pin screw terminal|1| | | | 3.5mm pitch 2-pin screw terminal|1| | | ||
| | 2N3904 NPN Transistor|1| | | | 2N3904 NPN Transistor|1| | | ||
| - | | 10k Ohm 1/4W 5% Resistor|1| Brown - Black - Orange| | + | | 1k Ohm 1/4W 5% Resistor (previously 10k)|1| Brown - Black - Red | |
| | 1N4001 Diode|1| | | | 1N4001 Diode|1| | | ||
| | 1x40pin male 0.1" pitch header| 9 pins worth| | | | 1x40pin male 0.1" pitch header| 9 pins worth| | | ||
| Line 68: | Line 68: | ||
| <code> | <code> | ||
| - | void setup() { | + | void setup() { |
| - | // initialize the relay pin as output | + | // Initialize the relay pin as output |
| - | pinMode(5, OUTPUT); | + | pinMode(5, OUTPUT); |
| } | } | ||
| void loop() { | void loop() { | ||
| - | digitalWrite(5, HIGH); // turn the relay on | + | digitalWrite(5, HIGH); // Turn the relay on |
| - | delay(1000); // wait for a second | + | delay(1000); // Wait for a second |
| - | digitalWrite(5, LOW); // turn the relay off | + | digitalWrite(5, LOW); // Turn the relay off |
| - | delay(1000); // wait for a second | + | delay(1000); // Wait for a second |
| } | } | ||
| </code> | </code> | ||
| + | |||