question about 14m button input

orko007

New Member
i donot have my 014M that i have ordered yet. But I have been reading and working on code already. For sake of this question i will say i want to turn on an led attached to output 0 when a button attached to input 1 is pushed and off when the button is released.

something like
main:
if pin1 = 1 then
high 0
else
low 0
endif
goto main

But my questions comes that i would like to just be able to have a button inbetween 0v and input 1. so when it is pressed it is 0v and not it is floating. is this possible to acomplish what i want and if so what would the logic be? from reading the manuals im not sure if this is possible.

could someone please enlighten my newb mind. Thank you.
 

MORA99

Senior Member
You can make a button with just 0V and floating when not pressed, but ofcause a floating pin may think its low or high randomly.
 

hippy

Technical Support
Staff member
If you want your button between input and 0V you also need a pull-up from input to +V.

For a button between input and +V you would need a pull-down from input to 0V.

With a push-to-close button between input and 0V, the input pin will normally read high (1) when not pushed ( pelled up to +V ), and will read low (0) when pushed ( shorted to 0V ).

The logic to turn on a LED when the button is pushed is to turn it on when the input becomes low (0), hence ...<code><pre><font size=2 face='Courier'> If pin1 = 0 Then
High 0 ' Led on, button pushed
Else
Low 0 ' Led off, button not pushed
End If
</font></pre></code> You can also use SYMBOL to give a more elegant and instantly understandable way of writing your code ...<code><pre><font size=2 face='Courier'> Symbol PUSHED = 0

If pin1 Is PUSHED Then
High 0 ' Led on, button pushed
Else
Low 0 ' Led off, button not pushed
End If
</font></pre></code>
 

orko007

New Member
Thanks Hippy thats what i got from the manual I was just looking for a shortcut in my wiring since once I get my project working the way I want I will be putting together many.
 
Top