Step 4: Circuit Diagram

Picture of Circuit Diagram
The PICAXE basic code is easy: the main loop keeps looking for a signal from the IR receiver via the "irin" command. When it gets a code, it places in in variable b0. Then that variable is tested with a series of "if...then" statements. If the condition is true, a subroutine is evoked, then the program returns to the main loop.

;IR Receiver Test Circuit
;for PICAXE-18M2
;James Dinsmore 7/01/2011

init: servo 3,140 ; initialise servo

irin [1000,main],B.2,b0 ;wait for new signal

if b0=16 then motorfwd
if b0=17 then motorbkwd
if b0=20 then stopmotor
if b0=21 then lightLED
if b0=24 then extinguishLED
if b0=19 then servoleft
if b0=18 then servoright
if b0=26 then servomiddle

goto main


motorfwd: high B.7
low B.6
goto main

motorbkwd: low B.7
high B.6
goto main

stopmotor: low B.7
low B.6
goto main

lightLED: high B.4
goto main

extinguishLED: low B.4
goto main

servoleft: servopos 3,200
goto main

servoright: servopos 3,80
goto main

servomiddle: servopos 3,140
goto main

lemaxnut2 years ago
I have been "playing" with PICAXE for about a year but I have never come across anyone who explains BASIC code and the IR function as clearly and succinctly as you have. I love all your projects !
Thanks for sharing.
jamesthequack (author)  lemaxnut2 years ago
You are very welcome! Thank you for the encouragement. My most recent material resides on http://jmd.dev4.webenabled.net/
They have recently upgraded the PICAXE-18M2+ to include an internal temperature sensor; I am looking forward to playing with it soon.