3 pin NPN Sensor

Does anyone know the code to operate a 3 pin NPN sensor using a push button to operate the sensor and when the sensor comes on the blue LED light will come on. 3 cables one is V+, one is ground and the other the signal cable.

Thanks for your help in advanced

i have no idea what a “NPN sensor” is supposed to be, and why the colour of the led is important, or why you need any code here, but kinda sounds like you just want an input pin to be copied into an output pin, that’s usually called a wire.

might wanna be more specific:

  • what is that “sensor” of yours
  • what is the schematic of your circuit (“a push button operates a sensor and a light comes on” tells us pretty much nothing about why you even have a microcontroller, also pretty sure it’s not a sensor if it’s operated by a button in-circuit)
  • what do you want the code to actually do

Please mention the name of the sensor , how LED comes into the picture and what exactly you want to do with sensor .