Placa 2 relee SPDT 5V

module

5 Review(s)
Placa 2 relee. Placa este compatibil cu Arduino,Raspberry PI si BeagleBone Black. Arduino Cod Sursa (cel mai simplu) int relayOne 2; int relayTwo 3; void setup() { Serial.begin(9600); pinMode(relayOne, OUTPUT); pinMode(relayTwo, OUTPUT); } void loop(...
Cod: MOD-27 / 814
Disponibilitate: In stoc
Producator: Pololu

49.00 RON


lensa.ro

Placa 2 relee. Placa este compatibil cu Arduino,Raspberry PI si BeagleBone Black. Arduino Cod Sursa (cel mai simplu) int relayOne 2; int relayTwo 3; void setup() { Serial.begin(9600); pinMode(relayOne, OUTPUT); pinMode(relayTwo, OUTPUT); } void loop() { setRelayState(0,1); delay(1000); setRelayState(1, 1); delay(1000); setRelayState(1, 0); delay(1000); setRelayState(0, 0); delay(1000); } void setRelayState(int relay, int state) { if (relay 1) digitalWrite(relayTwo, state); if (relay 0) digitalWrite(relayOne, state); } Cod Sursa (din tutorial) int relayOne 2; int relayTwo 3; String inputString ; boolean stringComplete false; int led 0; int whichRelay 0; void setup() { Serial.begin(9600); inputString.reserve(200); pinMode(relayOne, OUTPUT); pinMode(relayTwo, OUTPUT); } void loop() { if (stringComplete) { if (inputString relay 1 onn ) { setRelayState(0,1); Serial.println( RELAY 1 ON ); } else if (inputString relay 1 offn ) { setRelayState(0,0); Serial.println( RELAY 1 OFF ); } else if (inputString relay 2 onn ) { setRelayState(1,1); Serial.println( RELAY 2 ON ); } else if (inputString relay 2 offn ) { setRelayState(1,0); Serial.println( RELAY 2 OFF ); } else if (inputString relays onn ) { setRelayState(0,1); setRelayState(1,1); Serial.println( ALL RELAYS ON ); } else if (inputString relays offn ) { setRelayState(0,0); setRelayState(1,0); Serial.println( ALL RELAYS OFF ); } else { Serial.print( Unknown command: ); Serial.println(inputString); } inputString ; stringComplete false; } } void serialEvent() { while (Serial.available()) { char inChar (char)Serial.read(); inputString + inChar; if (inChar 39;n 39;) { stringComplete true; } } } Exemple de situatii: setRelayState(0,1) - releu 1 cuplat; setRelayState(1,1) - releu 2 cuplat; setRelayState(0,0) - releu 1 decuplat; setRelayState(1,0) - releu 2 decuplat; void setRelayState(int relay, int state) { if (relay 1) digitalWrite(relayTwo, state); if (relay 0) digitalWrite(relayOne, state); } Un alt exemplu de proiect (tutorial video, aprindere lumina la bataie din palme). Foloseste in plus un microfon . Raspberry PI Actionarea bobinelor releelor se face prin tranzistoare (incluse pe placa), care se conecteaza la pinul 5V Raspberry PI, ceea ce inseamna ca placa nu solicita aproape deloc pinii GPIO Raspberry PI din punct de vedere al curentului consumat de aceasta (curentul necesar este tras din pinul de 5V, iar pinii GPIO dau doar comanda). Vezi filmul de mai jos pentru detalii de conectare. Cod Sursa from time import sleep import sys import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(23, GPIO.OUT) GPIO.setwarnings(False) GPIO.setup(24, GPIO.OUT) GPIO.output(23, False) GPIO.output(24, False) def set_relays_state(relay1, relay2): if relay1 1 : GPIO.output(23, True) else: GPIO.output(23, False) if relay2 1 : GPIO.output(24, True) else: GPIO.output(24, False) set_relays_state(sys.argv[1],sys.argv[2]) sleep(1) Specificatii: Comanda 5V 250V 10 A 2 Relee Omron G5LE-14-DC5 Greutate : 33g Linkuri: Pagina producator
Opinia ta despre produs


deal.ro

Recomandari