Hai this is Ravi from India. Im very new to arduino... Im working with a new project Read npn no proximity sensor status change detection.... 0 to 1 or 1 to 0..
Relay should active if any changes in proximity sensor from high to low or low to high..
Ravi, you need to take the first step and present your best effort to code this, even if you can only type into pseudocode what you want the code to do. Then we can help expand the code, and correct the syntax.
Q1. What type of proximity sensor you are using give part number.?
Q2.are you using any relay driver board ? or you made it your own board. ?
Q3. provide components part number like BC547, 5V or 12V or 24VDC relay.etc..
Q4. Provide brief about your application.
Note: 'npn' is a way of saying "Open Collector/Drain Output". That mean you need a pull-up resistor for that signal. Perhaps setting the input to INPUT_PULLUP will be sufficient.