Arduino Shield – Relais shield
Hardware
Dit shield bevat 4 relais en is eenvoudig te bedienen doormiddel van een digitale uitgang op de arduino (4,5,6,7) hoog te maken.
Informatie (ENG):
- Compatible with Arduino UNO, Makerduino UNO and other boards with the similar structure and function.
- Standardized shape design.
- 5VDC control voltage.
- 4 high quality mechanical relays.
- High quality screw terminal.
- Provides NO/NC interfaces.
Script
Onderstaand script laat elk relais 1 voor 1 opkomen en tegelijk afvallen.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
const byte Relay1 = 7; const byte Relay2 = 6; const byte Relay3 = 5; const byte Relay4 = 4; void setup () { pinMode(Relay1, OUTPUT); pinMode(Relay2, OUTPUT); pinMode(Relay3, OUTPUT); pinMode(Relay4, OUTPUT); } void loop () { digitalWrite(Relay1, HIGH); delay(500); digitalWrite(Relay2, HIGH); delay(500); digitalWrite(Relay3, HIGH); delay(500); digitalWrite(Relay4, HIGH); delay(500); digitalWrite(Relay1, LOW); digitalWrite(Relay2, LOW); digitalWrite(Relay3, LOW); digitalWrite(Relay4, LOW); delay(1000); } |