Help whit code for a little project

found the issue....thanks

is there a way of getting 5v as input rather than gnd?

that works aswell...thanks
how do i get 5v to trigger the input?

5v should make an input pin HIGH

led's come on when input is connected to ground how do i change the code to activate when it gets 5v

if the LEDs are active LOW and you want them On when the button is HIGH you want to invert the button input value

digitalWrite (LED_ONE, ! digitalRead (BTN_PIN));

got it..il try that...thanks

hey guys..just realized me sensor is given a negative voltage output..can the input be triggered by a negative voltage?

Use an opto isolator

thanks..would -1.7v be enough to trigger

Depends on the opto coupler.

img_1224968365_15412_1293141599_mod_393_274

A 4N32 for example, has a LED Vfwd of ≈ 1.3v therefore it should work.

1.7v - 1.3v = .4v

.4v ÷ 5mA = 80Ω for the LED resistor. (use 100R)

There are lots of couplers to choose from.

Show us the sensor circuit ?

its a proximity sensor..the output sits at 0v when not detecting and when detecting goes to minus 1.7v

Is it open collector ?

Does it have output current limiting ?

Give us a link.

was trying to get the output of sensor to switch a transistor
dont know if its not enough current to switch or because of the negative voltage

Need to see the equivalent output drive circuit of your detector.

Might be a dry/wet contact, an opto isolator, an NPN or PNP transistor, too many options to guess at. :thinking:

The data sheet sez there is an opto-isolated output signal.

But it also notes “Not for use on Puffins/Toucans”, which seems a bit specific and odd.

a7

from the spec Low voltage
supply and opto
isolator detect
outputs

Hi,
Please show us a circuit diagram of your project, please include pin and component labels and power supply.

Can you please post some pictures of your project so we can see your component layout?

-1.7V from where to where?
Between what points?

Thanks.. Tom.. :smiley: :+1: :coffee: :australia:

-1.7V? do you have the grounds connected properly?