Variable on Logicator

Gapak

Senior Member
I use Logicator to program a Picaxe 20M2 for my projects. I sometime need to check the status of an output pin to make a decision command in my program. My crude way of doing this is to hard wire this output pin to an available input pin then proceed as if the output was an input. Is there a more elegant way of doing this by asking a variable to reflect the status of the output and use a compare command in the Logicator? Thanks for your guidance.
 

hippy

Technical Support
Staff member
You can set a variable to reflect the output pin state; for example, whenever the pin is set high set the variable to 1, whenever the pin is set low, set the variable to zero.
 

Gapak

Senior Member
Thank you for your reply; this is exactly what I want to do. I am kind of clumsy when it comes to programming! The problem is that I do not know how to do what you say with the Logicator commands/pop up windows?
 

hippy

Technical Support
Staff member
You can use the "Expression" command to assign a value to a variable, can use "Compare" to check its value. Both can be found under the "Variables" section of the toolbox.
 

Gapak

Senior Member
OK, I go to the "Expression" command pop up window; I try to set VAR A to reflect output B7 of the 20M2. If I type B7 the B does not stay. If I scroll the values there is no B7 in the list. I am stuck again!
Please excuse my lack of experience.
 

hippy

Technical Support
Staff member
You cannot set a variable to reflect the output pin. But you can set the variable to 1 or 0. So after every "High" command you can set a variable to 1, and after every "Low" command you can set variable to 0. The variable will then match whatever the pin has been set to.
 
Top