12.07.2015 Views

PICAXE Manual Section 1 - TechnoPujades - Free

PICAXE Manual Section 1 - TechnoPujades - Free

PICAXE Manual Section 1 - TechnoPujades - Free

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

www.picaxe.co.uk<strong>Section</strong> 1 69GETTING STARTEDThis second program shows how a variable can be used to transfer informationinto a sub-procedure. In this case variable b2 is used to tell the microcontroller toflash 5, and then 15, times.symbol LED = 4symbol counter = b1‘ rename output4 ‘LED’‘ define a counter using variable b1main:‘ make a label called ‘main’let b2 = 5 ‘ preload b2 with 5gosub flash‘ call the sub-procedure flashpause 500‘ wait a whilelet b2 = 15 ‘ preload b2 with 15gosub flash‘ call the sub-procedure flashpause 500‘ wait a whilegoto main‘ loop backend‘ end of the main programflash:for counter = 1 to b2high LEDpause 250low LEDpause 250next counterreturn‘ make a sub-procedure called flash‘ start a for…next loop‘ LED on‘ wait 0.25 second‘ LED off‘ wait 0.25 second‘ next loop‘ return from the sub-procedurerevolution(c) Revolution Education Ltd. Email: info@rev-ed.co.uk Web: www.rev-ed.co.ukVersion 6.9 07/2009All rights reserved.69

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!