Wow. You haven’t given us much to work with, so I’ll make up some suggestions.
I want to use my Arduino to power a sensor. Depending on the input recieved from the sensor I want to turn the LEDs on or off.
However I find that when I connect the sensor to the Vin the leds turn off.
You said that you want to power the sensor from the Arduino, but this sentence suggests that you’re powerint the sensor from Vin, which means that you’re powering it from an external power supply. Which is it? If you’re powering from Vin, you’ll want to be sure that the sensor output voltage is compatible with the Arduino - that it’s voltage doesn’t exceed 5V, and, for a digital output, that the low output is low enough to reliably read 0, and the high output is high enough to reliably read 1. Make sure that you’re not hooking it up backwards, and sending your DC supply into current-limiting.
My leds are powered from the terminal with pins 1-13 and they are all commonly tied to gnd on the same side of the board.
It sounds like you have 13 LEDs, you’re driving each one with a separate pin, and they all come on at once. So let’s ask:
- Are you using series resistors with the LEDs? If you’re not, then the pins are delivering too much current.
- What’s the current per LED? If the total is 200 mA or more, the IC is delivering too much current.
I’ll suggest that you take the LED off of pin 1 so that you can get Serial working, and print some diagnostic messages. Something like, “Sensor reads , turning LEDs off.” That will give you a lot of clues. You’ll also do well to reduce the number of LEDs to as few as are necessary, to reduce the load on the IC and the on-board voltage regulator, until you verify that drawing too much current isn’t your problem.
What is it that I am doing wrong?
You’re not telling us enough. You’ve offered very few clues; it’s unlikely that we can guess what you’re doing wrong. Post some code, at least, and if, as a new poster, the system won’t let you post a schematic, give us a much better description of your circuit. Tell us what the sensor is sensing, and give us a part number, and a link to its datasheet. Take some voltage readings when the system behaves unexpectedly - especially Vin, VCC, and the sensor output.