1

I just make a simple circuit with uno and breadboard ,that connected 4 LED and 4 IR sensor. The arduino program is simple that makes the light on or off with the determination of IR sensors .

However my computer cannot find the USB COM when it connects the 5v and GND. Hence, I plug out the 5v and GND that connect to the breadboard .The computer can recognize COM 4 then . I successfully upload the program after this .

Now , when I connect the computer and UNO to give battery to UNO , no battery passed (because the computer cannot detect the USB COM) .The lights of IR sensor aren't on .How to tackle the problem?

It failed to give battery with external battery too unless I plug out the 5v and GND

This is my simple program:

int irPin1 = 2;
int ledPin1 = 13;
int irPin2 = 3;
int ledPin2 = 11;
int irPin3 = 4;
int ledPin3 = 9;
int irPin4 = 5;
int ledPin4 = 7;
int serialSpeed = 9600;

void setup() {
  // put your setup code here, to run once:
  pinMode(irPin1,INPUT);
  pinMode(irPin2,INPUT);
  pinMode(irPin3,INPUT);
  pinMode(irPin4,INPUT);
  pinMode(ledPin1,OUTPUT);
  pinMode(ledPin2,OUTPUT);
  pinMode(ledPin3,OUTPUT);
  pinMode(ledPin4,OUTPUT);
  Serial.begin(serialSpeed);
}

void loop() {
  // put your main code here, to run repeatedly:
  int reading1 = digitalRead(irPin1);
  int reading2 = digitalRead(irPin2);
  int reading3 = digitalRead(irPin3);
  int reading4 = digitalRead(irPin4);
  digitalWrite(ledPin1,reading1);
  digitalWrite(ledPin2,reading2);
  digitalWrite(ledPin3,reading3);
  digitalWrite(ledPin4,reading4);
  String output = "{\"1\":" + (String)reading1 + ",\"2\":" + (String)reading2 + ",\"3\":" + (String)reading3 + ",\"4\":" + (String)reading4 + "}";
//  String output = "{\"" + (String)reading1 + "\",\"" + (String)reading2 + "\",\"" + (String)reading3 + "\",\"" + (String)reading4 + "\"}";
  Serial.println(output);
  delay(100);
}

My Arduino circuit:

UNO 5v to breadboard 5v

UNO GND to breadboard GND

1st set: IR :5v GND from breadboard , pin from UNO

2nd set: IR :5v GND from breadboard , pin from UNO

3rd set: IR :5v GND from breadboard , pin from UNO

4th set: IR :5v GND from breadboard , pin from UNO

6
  • 1
    Can you upload an actual picture of your breadboard? Think you have short. Mar 26, 2019 at 21:06
  • @Zunzullaalagaty see update ! My Arduino circuit: UNO 5v to breadboard 5v UNO GND to breadboard GND 1st set: IR :5v GND from breadboard , pin from UNO 2nd set: IR :5v GND from breadboard , pin from UNO 3rd set: IR :5v GND from breadboard , pin from UNO 4th set: IR :5v GND from breadboard , pin from UNO
    – Monchhichi
    Mar 26, 2019 at 21:13
  • on a first glance it seems fine actually. What I see from your picture is that your arduino doesnt light up. If you press the reset button, does any led light up? If not, try disconnecting sensors and leds until it starts to light up when pressing the reset button Mar 26, 2019 at 21:16
  • @Zunzullaalagaty The power is fine after I plug one of the IR out .What just happened? what is short circuit actually
    – Monchhichi
    Mar 26, 2019 at 21:30
  • 1
    It's a circuit where the current can pass without any consumer. It seems like you have that IR sensors plugged in wrong? Or maybe made a mistake in the code about the Input and Output for the IR sensor. Mar 26, 2019 at 22:15

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.