Adding LEDs between inputs

Hi,

I would like to know if it is possible to add leds between the inputs (reed switches)
Iam using INPUT_PULLUP

PinX -> reed switch -> led -> GND
See image below
Simple yes or no will do :wink:

You have no current limiting resistors, and no.
So what are you trying to achieve?
If it is showing if the reed switch is closed and those pins are inputs, the LEDs will prevent the input going low enough to register as a logic zero input.

@Grumpy_Mike

The basic idea is to have 10 inputs representing a 0-100% scale (1 input per 100L) of a water tank.
Based on how many switches are closed/open i can send that via MQTT to my home automation.
So i can see how much water is in the tank, + how much we are using.

The leds would only serve as a indicator on the tank itself.

If... you only want to use 10 pins of that Mega,
then connect the reed switch between pin and ground.
And add a LED (with current limiting resistor!) between 5volt and pin.

Use pull up in pinMode
pinMode(level1Pin, INPUT_PULLUP);

You could also us 10 pins for the reed switches and 10 pins for the LED/resistors.
Leo..

Basically you can not light LEDs from an input pin like that.

If you want an indication that a reed switch is triggered and read the input at the same time use the circuit shown in this link
http://www.thebox.myzen.co.uk/Hardware/Pendulum.html