Relay Channel..

i upload the code where all the components are being driven.

This is the simple sketch for the 2 channel relay.
it uses Transistor to transistor Logic.

i tried this code upload to the arduino with all of the components connected but still the relay wont work.

void setup () {
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  Serial.begin(9600);
  digitalWrite(8,LOW);
  digitalWrite(9,LOW);
  delay(2000);
  
  digitalWrite(8,HIGH);
  digitalWrite(9,HIGH);
}
void loop () {
  if (Serial.available () > 0) {
    char a = Serial.read ();
    Serial.println(a);
    if (a == '1') {
      digitalWrite(8, LOW);
    } if (a == '2') {
      digitalWrite(8, HIGH);
    } if (a == '3') {
      digitalWrite(9, LOW);
    } if (a == '4') {
      digitalWrite(9, HIGH);
    }
  }
}

Main.zip (2.44 KB)