' LEDFLASH.BAS program for Feb. 2003 "Silicon Chip" PICAXE-08 article ' Author - Stan. SWAN => s.t.swan@massey.ac.nz Ver 1.0 Jan. 2003 ' Further comments/ASCII art 17th & 27th Sept 2003, but code unchanged ' ' It's traditional to test ones new microcontroller by easy LED flashing, ' -but this is such a trivial Picaxe task that hardly worth sweating ! ' Further LEDs can be added at Pins 0,1 & 4 -extend code to suit. Light ' chasers etc easily rolled up via small PAUSE delays between each LED ' NOTE - although initially added, dropping R's NOT NEEDED now since ' Picaxe-08 has current limit of 25mA per pin ( rather bright for red) ' NB-white LEDs (due to phosphor coating on blue) may show "warm up' & ' afterglow lag & not true instant on/off. ~1ms interpreter overhead too ' ' Aside from "traffic light" simulations( c/w even a "cross now" buzzer ?) ' espec. useful extensions to explore relate to human flicker perception ' or battery life enhancement via tweaked mark/space ratios. Suit white LED ' front bike light or "lost in the bush" beacon, since-GRR!-classic LM3909 ' IC (used 1970s-mid '90s) LED flasher now discontinued. Winner (on TV too) ' Mikaela (7 yrs old!) did this for Aug.'03 "Science Fair"-New Plymouth, NZ ' Such trials can be a REAL CHORE now LM3909 gone, needing 555 & parts box ' since 2 interelated formula need tweaking for 2 R's & large C involved. ' The parts count,size & maybe even cost is also better with Picaxe-08s ! ' Care- flash rates ~ 10Hz are annoying & may even cause epileptic fits '-------------------------------------------------------------------------- ' - - - - - - - - - - - -ve rail ' Piezo L L NB-useful to include such ' and/or E E "ASCII Art Schematic " ' LED D D layouts for more complex ' Pin| _____ + + designs, since it allows a ' 0 | ___ | Pin | | Pin single file to contain all ' -+---- | |__2 ___| | 1 circuit info. Comments etc ' |Picaxe| |____________ __| -if are NOT ported to the PICAXE ' | 08 | used but ARE conveniently saved ' ------ on your editing PC hard disk ' |__ __4__| (NB- pin 3 input only) ' ||| 'Usual 3 wire + + + + + + +ve supply 'prog.input 3 - 5V dc '--------------------------------------------------------------------------- ' Copy/paste program from web site => www.picaxe.orcon.net.nz/ledflash.bas ' Lines preceeded by ', are documentation only & may be left out if typing '--------------------------------------------------------------------------- ledflash: ' LED flash rate & mark/space experiment high 2 ' turn on output pin 2- LED lights up pause 5 ' keep it on for 5 milliseconds low 2 ' turn off pin 2 - LED goes out pause 50 ' keep it off for 50 ms goto ledflash ' repeat routine