MakerFaire_01.bas (933Bytes)
The documentation for the AXE023 motor driver board for the PICAXE-08 states that, "pin5 cannot be used with the PICAXE-08 system as this is the serial input pin".
However, Chris the Carpenter pointed out the PICAXE disconnect command, which you can find in PICAXE Manual 2. The manual states:
"The PICAXE chips constantly scan the serial download pin to see if a computer is trying to initialise a new program download. However when it is desired to use the download pin for user serial communication, it is necessary to disable this scanning."
The newer PICAXE-08M2 chip can use pin5 as in Input pin, in addition to its function as Serial In. Using the disconnect command at the beginning of the program allows you to use pin5 on the PICAXE-08M2 not only for serial communication, but as a digial input as well.
After the disconnect is used, you will need to do one of the following in order to download a new program to the PICAXE:
- use the reconnect command
- issue a reset comment
- perform a hardware reset, which you can do by cycling the power
Here's a code snippet:
init:
disconnect 'allows use of pin5 as input
main:
do
if pin3 = 1 and pin5 = 0 then
gosub backturnl
end if
if pin5 = 1 and pin3 = 0 then
gosub backturnr
end if
if pin3 = 1 and pin5 = 1 then
gosub backturnspin
end if
Added tip: I like to use a small switch to make it easier to change between program and run modes. Otherwise you need to constantly move the little jumper.
(Click the pic for a larger image.)