Pls Help.

paviag

New Member
I am wondering if the picaxe chip can be controlled by one input (switch) to switch the same output say 3 high, then low with alternative presses of a button. Ie, can u switch something on and off on the same pin by only pressing the one input switch?
 

BeanieBots

Moderator
Yes you can.
First test the input state.
If the button is pressed jump to a routine otherwise keep testing.
Once you have detected a button press, either use the toggle command to change the output state or use a variable to keep note of the output state and do another jump depending on its state.
 

Rickharris

Senior Member
<BLOCKQUOTE><font size=1 face=arial>quote:<hr height=1 noshade>
I am wondering if the picaxe chip can be controlled by one input (switch) to switch the same output say 3 high, then low with alternative presses of a button. Ie, can u switch something on and off on the same pin by only pressing the one input switch? <hr height=1 noshade></BLOCKQUOTE></font><font face='Verdana, Arial, Helvetica' size=2>

Perhaps I have read your question incorrectly but you will not be able to turn on/off the input you have looked at to get the signal.

You can do this:

<code><pre><font size=2 face='Courier'>
start:
if pin3=1 then switch
goto start

switch:
toggle 2
wait 1
goto start

&lt;/font&gt;&lt;/pre&gt;&lt;/code&gt;

every time you turn on pin 3 then pin 2 will turn on or off depending on its previous state.
The wait is to give you time to take your finger off the input switch ;)

Edited by - rickharris on 05/03/2006 09:41:43 </font></pre></code>
 
Top