button command

sarabande

New Member
hi guys

I am new to this and starting procedings with the picaxe 08m.
I am reading the manual and comprehending and applying the commands
as suggested to get a feel for the code but I am struggling to understand
the "button' command ( page 28-29 in the manual ) Using the example code given I am trying to break down its operation step by step but I am totally
confused,I know it can be used for debouncing but how? what is the toggle
command for etc and lastly what as an instruction/syntax, does the comma . represent?
hope you can be patient and help me
 

westaust55

Moderator
Firstly, welcome to the PICAXE forum.

with respect to the BUTTON command, have a read though these past thread.
In the first Beaniebots gave a good description after some experimentation:

http://www.picaxeforum.co.uk/showthread.php?t=10864

http://www.picaxeforum.co.uk/showthread.php?t=10884


a comma is used as a separator between pieces of information.
while I tend to add a space after each comma for readability, the space is not essential as the comma is the separation character.

Edit:
The TOGGLE command operates on output pins of the PICAXE and does as the name implies. That is, it toggles the output pin on and off by swapping between the two states.

If an output is OFF or LOW, then TOGGLE will turn it ON or HIGH
If an output is ON or HIGH then TOGGLE will turn it OFF or LOW
 
Last edited:

boriz

Senior Member
Describing it as ‘turn on’, or ‘turn off’ might be a little misleading.

A Picaxe digital output is either HIGH, in which case the voltage on that pin is about the same as the Picaxe supply voltage (Normally +5v), or the output is LOW, in which case the voltage measured on the pin is zero. (Assuming you are measuring the voltage with respect to the Picaxe ground/0v.)

EG:

With an LED+resistor connected between +5v and the output pin, a LOW command would turn the LED on, a HIGH command would turn the LED off.
 

BCJKiwi

Senior Member
Better to think of an output as a 3 position switch with one side connected to +V, the middle not connected to anything, and the other side connected to 0V.

So when 'High' it will supply (or source) current from the PICAXE +V to the external circuit
When changed to an input (if the port can be changed to an input) it will be in the middle postion and at high resistance = = 'not connected'
When 'Low' it will allow current fom the external circuit into the the port (or sink) to PICAXE 0V.
 
Top