User Tools

Site Tools


digispark:tutorials:relay

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
digispark:tutorials:relay [2013/02/09 22:13]
mcb1 [Parts:]
digispark:tutorials:relay [2013/03/29 06:57]
PeterMortensen [Programming:] Copy edited [8]. Replaced TABs with spaces to ease formatting, etc.
Line 4: Line 4:
 [[https://​s3.amazonaws.com/​digispark/​images/​m/​relay1.jpg|{{https://​s3.amazonaws.com/​digispark/​images/​t/​relay1.jpg}}]][[https://​s3.amazonaws.com/​digispark/​images/​m/​relay7.jpg|{{https://​s3.amazonaws.com/​digispark/​images/​t/​relay7.jpg}}]][[https://​s3.amazonaws.com/​digispark/​images/​m/​relay6.jpg|{{https://​s3.amazonaws.com/​digispark/​images/​t/​relay6.jpg}}]] [[https://​s3.amazonaws.com/​digispark/​images/​m/​relay1.jpg|{{https://​s3.amazonaws.com/​digispark/​images/​t/​relay1.jpg}}]][[https://​s3.amazonaws.com/​digispark/​images/​m/​relay7.jpg|{{https://​s3.amazonaws.com/​digispark/​images/​t/​relay7.jpg}}]][[https://​s3.amazonaws.com/​digispark/​images/​m/​relay6.jpg|{{https://​s3.amazonaws.com/​digispark/​images/​t/​relay6.jpg}}]]
  
-The Relay Shield Kit connects a Omron G5Q relay to the Digispark development board. This allows the Digispark to turn AC and DC loads on and off up to 250VAC. The relay is rated for 3A@125VAC3A@250VAC, and 5A@30VDC.+The Relay Shield Kit connects a Omron G5Q relay to the Digispark development board. This allows the Digispark to turn AC and DC loads on and off up to 250 VAC. The relay is rated for 3 A @125 VAC3 A @250 VAC, and 5 A @30 VDC.
  
 This is an unassembled kit and requires basic soldering. This is designed for use with the Digispark development board, which is not included. This is an unassembled kit and requires basic soldering. This is designed for use with the Digispark development board, which is not included.
- 
  
 =====Parts:​===== =====Parts:​=====
Line 69: 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>​
 +
digispark/tutorials/relay.txt · Last modified: 2016/06/09 12:03 (external edit)