Reading Status of Input Pins


New Member
I am using a command in my 14m program like:
let b5 = pin2
this command has worked to put the status of input 2 into b5 so i can then use it for whatever.
This command is currently resetting my program back to the first label. THe program has two debug's, a setfreq m8, and several symbol declarations before the label
It is not resetting before the first label but right there.
This same thing is happening on several picaxe 14m's. However it is not happening on some picaxe 14m's i bought from another source. Picaxe copys perhaps?
Anyway, I need a workaround for this. I just need to read the instant state of the pin onto a variable.


Senior Member
It's unlikely to be a knock-off PICAXE copy, but knowing the Firmware versions of the ones which do and do not work would be useful. Use View->Options->Mode->Firmware? to determine that while the PICAXE is connected as if to download, and the version is reported after Clear Memory.

You'll need to provide more convincing evidence that it is the &quot;let b5=pin2&quot; which causes a reset and not something else. The following test program should help -<code><pre><font size=2 face='Courier'> SetFreq M8
Pause 5000
Let b5 = pin2
If b5 = 0 Then
End If
Pause 1000
Loop </font></pre></code> Download the program. Press F8 to bring up the Terminal window, select 9600 baud and you should see &quot;0&quot; or &quot;1&quot; printed indicating when Pin 2 is high or low.

If you see &quot;Reset&quot; printed then there's definitely a problem somewhere. If not it would require further investigation as to what's going wrong in your program.